| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- $(function () {
- $("#form-dictionaryitem-add").validate({
- rules: {
- name: {
- required: true,
- minlength: 1,
- maxlength: 60,
- remote: {
- url: pagePath + "/super/isExistDictionaryItem",
- type: "get",
- data: {
- name: function () {
- return $("#name").val();
- },
- value:'',
- id: '',
- typeId: function () {
- return $("#typeId").val();
- }
- }
- }
- },
- value: {
- required: true,
- minlength: 1,
- maxlength: 60,
- remote: {
- url: pagePath + "/super/isExistDictionaryItem",
- type: "get",
- data: {
- name: '',
- value: function () {
- return $("#value").val();
- },
- id: '',
- typeId: function () {
- return $("#typeId").val();
- }
- }
- }
- }
- },
- messages: {
- name: {
- remote: "该数据类型条目已存在!"
- },
- value: {
- remote: "该数据类型值已存在!"
- }
- },
- onkeyup: false,
- focusCleanup: true,
- focusInvalid:false,
- success: "valid",
- submitHandler: function (form) {
- // $(form).find(":submit").attr("disabled", true);
- $(form).ajaxSubmit({
- type: 'post',
- url: pagePath + "/super/dictionaryItem/save",
- 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跳转。
- }
- });
- });
|