| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- $(function () {
- $("#form-dictionaryitem-edit").validate({
- rules: {
- name: {
- required: true,
- minlength: 1,
- maxlength: 60,
- remote: {
- url: pagePath + "/super/isExistDictionaryItem",
- type: "get",
- data: {
- name: function () {
- return $("#name").val();
- },
- value: '',
- id: function () {
- return $("#id").val();
- },
- 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: function () {
- return $("#id").val();
- },
- 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跳转。
- }
- });
- });
|