| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- $(function () {
-
- $("#form-floor-add").validate({
- rules:{
- build_number:{
- required:true,
- minlength:1,
- maxlength:50
- },
- 'floorList[0].area': {
- isFloat2:true
- },
- 'floorList[0].pay': {
- isFloat2:true
- }
- },
- onkeyup:false,
- focusCleanup:false,
- success:"valid",
- submitHandler:function(form){
- // $(form).find(":submit").attr("disabled", true);
- $(form).ajaxSubmit({
- type: 'post',
- url: pagePath+"/build/floor/saveBuilding",
- dataType:"json",
- success: function(data){
- if(data.success){
- succeedMessage(data.message);
- setTimeClose();
- }else {
- // $(form).find(":submit").attr("disabled", false);
- errorMessage(data.message);
- }
- },
- error: function () {
- errorMessage('系统错误!');
- }
- });
- return false; // 非常重要,如果是false,则表明是不跳转,在本页上处理,也就是ajax,如果是非false,则传统的form跳转。
- },
- // errorPlacement: function(error, element) {
- // if( element.attr('id') == 'floorList[0].floor'
- // || element.attr('id') == 'floorList[0].area'
- // || element.attr('id') == 'floorList[0].pay'
- // ){
- // error.addClass(' label_error')
- // }
- // error.appendTo(element.parent());
- // }
- });
- });
- $("#form-floor-edit").validate({
- rules:{
- build_number:{
- required:true,
- minlength:1,
- maxlength:5
- },
- 'floorList[0].area': {
- isFloat2:true
- },
- 'floorList[0].pay': {
- isFloat2:true
- }
- },
- onkeyup:false,
- focusCleanup:true,
- success:"valid",
- submitHandler:function(form){
- // $(form).find(":submit").attr("disabled", true);
- $(form).ajaxSubmit({
- type: 'post',
- url: pagePath+"/build/floor/save",
- dataType:"json",
- success: function(data){
- if(data.status == "success"){
- succeedMessage(data.message);
- var index = parent.layer.getFrameIndex(window.name);
- parent.location.reload();
- parent.layer.close(index);
- }else {
- // $(form).find(":submit").attr("disabled", false);
- errorMessage(data.message);
- }
- },
- error: function () {
- errorMessage('系统错误!');
- }
- });
- return false; // 非常重要,如果是false,则表明是不跳转,在本页上处理,也就是ajax,如果是非false,则传统的form跳转。
- },
- });
|