contactManagement_edit.js 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /*$("#form-contact").validate({
  2. rules:{
  3. did:{
  4. required:true
  5. },
  6. contact_name:{
  7. required:true
  8. }
  9. },
  10. message:{
  11. name:{
  12. required:'这是必填字段'
  13. },
  14. contact_name:{
  15. required:'这是必填字段'
  16. },
  17. onkeyUp:false,
  18. focusCleanup:false,
  19. success:'valid',
  20. submitHandler:function(form){
  21. $(form).ajaxSubmit({
  22. type:"post",
  23. dataType:"json",
  24. url: pagePath + "/contactManagement/save",
  25. //data:{},
  26. success: function(data){
  27. if (data.success) {
  28. succeedMessage(data.message);
  29. setTimeClose();
  30. } else {
  31. // $(form).find(":submit").attr("disabled", false);
  32. errorMessage(data.message);
  33. }
  34. },
  35. error: function(){
  36. errorMessage('系统错误!');
  37. }
  38. return false;
  39. });
  40. }
  41. });*/
  42. $("#form-contact-edit").validate({
  43. rules: {
  44. did:{
  45. required:true
  46. },
  47. contact_name:{
  48. required:true
  49. }
  50. /*registration_capital: {
  51. number:true
  52. },
  53. */
  54. },
  55. messages: {
  56. did:{
  57. required:'这是必填字段'
  58. },
  59. company_name: {
  60. required:'这是必填字段'
  61. //remote: "该公司名已存在!"
  62. }
  63. },
  64. onkeyup: false,
  65. focusCleanup: true,
  66. success: "valid",
  67. submitHandler: function (form) {
  68. $(form).ajaxSubmit({
  69. type: 'post',
  70. url: pagePath + "/contactManagement/edit/" + + $("#contactId").val(),
  71. dataType: "json",
  72. success: function (data) {
  73. if (data.success) {
  74. succeedMessage(data.message);
  75. setTimeClose();
  76. } else {
  77. // $(form).find(":submit").attr("disabled", false);
  78. errorMessage(data.message);
  79. }
  80. },
  81. error: function () {
  82. errorMessage('系统错误!');
  83. }
  84. });
  85. return false; // 非常重要,如果是false,则表明是不跳转,在本页上处理,也就是ajax,如果是非false,则传统的form跳转。
  86. }
  87. });