| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- $(function () {
- jQuery.validator.addMethod("smallerThan", function(value, element,param) {
- value=parseFloat(value);
- var gtValue =parseFloat( $("#"+param).val());
- return value <= gtValue;
- }, "输入数据不合法");
-
- $("#form-tenancy-detail-edit").validate({
- rules:{
- remark:{
- maxlength: 255
- },
- paid_house_fee:{
- min: 0,
- number:true,
- smallerThan:"house_fee",
- required:true,
- isFloat2: true
- }
- },
- messages:{
- paid_house_fee:{
- smallerThan:"已缴房租必须小于应缴房租"
- }
- },
- onkeyup:false,
- focusCleanup:true,
- success:"valid",
- submitHandler:function(form){
- // $(form).find(":submit").attr("disabled", true);
- $(form).ajaxSubmit({
- type: 'post',
- url: pagePath+"/build/tenancy/detail_update",
- dataType:"json",
- data:{
- isPush:$("#isPush").val()
- },
- success: function(data){
- if(data.success){
- succeedMessage(data.message);
- setTimeClose();
- }else {
- // $(form).find(":submit").attr("disabled", false);
- errorMessage(data.message);
- }
- }
- });
- return false; // 非常重要,如果是false,则表明是不跳转,在本页上处理,也就是ajax,如果是非false,则传统的form跳转。
- }
- });
- });
- /*
- 参数解释:
- title 标题
- url 请求的url
- id 需要操作的数据id
- w 弹出层宽度(缺省调默认值)
- h 弹出层高度(缺省调默认值)
- */
- function tenancy_dialog(title,url,w,h){
- layer_show(title,pagePath+url,w,h);
- }
|