中文字幕av专区_日韩电影在线播放_精品国产精品久久一区免费式_av在线免费观看网站

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

jqueryFormvalidator Ajax修改數據驗證是否存在

發布時間:2020-05-29 03:23:01 來源:網絡 閱讀:873 作者:kafeihouye 欄目:web開發

 

  1. var accErrorMsg = "請輸入客戶分類名稱"
  2. //表單數據驗證 
  3. $(function(){ 
  4.                 //$.formValidator.initConfig({formid:"myform",autotip:true});    
  5.         $.formValidator.initConfig({ 
  6.                     formid:"myform", 
  7.                     autotip:true 
  8.                 }); 
  9.                  
  10.                 $("#name").formValidator({ 
  11.                 onshow:"請輸入客戶分類名稱", 
  12.                 onfocus:"2至20個字符", 
  13.                 oncorrect:"輸入正確"}).functionValidator({ 
  14.                                         fun: function(){ 
  15.                                             var roleName = $("#name").val(); 
  16.                                             if(trim(roleName)=="") 
  17.                                             { 
  18.                                                  accErrorMsg = "請輸入客戶分類名稱"
  19.                                                  return accErrorMsg; 
  20.                                             }else if(trim(roleName).length==1 ||trim(roleName).length>20){ 
  21.                                                  accErrorMsg="2至20個字符"
  22.                                                  return accErrorMsg; 
  23.                                             } 
  24.                                             else 
  25.                                             {                                                
  26.                                                 return true; 
  27.                                             } 
  28.                                         } 
  29.                                     }).ajaxValidator({ 
  30.                                         type:"post", 
  31.                                         url: "${basePath}clientSortSTManage/clientSortST!isClientSortNameExist.action", 
  32.                                         datatype: "json", 
  33.                                         timeout: 3000,   
  34.                                         success: function(data) 
  35.                                         { 
  36.                                             //將老角色名與新角色名比較,如果一樣判為通過 
  37.                                             var oldName = $('#oldName').val(); 
  38.                                          
  39.                                             var rName = $('#name').val();    
  40.                                             if(oldName && oldName==rName) 
  41.                                             { 
  42.                                                 return true; 
  43.                                             }        
  44.                                          
  45.                                             //根據ajax返回結果判斷       
  46.                                             var correct = data.correct; 
  47.                                             if(correct) 
  48.                                             { 
  49.                                                 return true; 
  50.                                             } 
  51.                                             else 
  52.                                             { 
  53.                                                 return false; 
  54.                                             } 
  55.                                              
  56.                                              
  57.                                         },                               
  58.                                         error: function() 
  59.                                         { 
  60.                                             artalert("服務繁忙,請稍后再試!"); 
  61.                                         }, 
  62.                                         onerror : "客戶分類名稱已存在,請更換客戶分類名稱", 
  63.                                         onwait : "正在對客戶分類名稱進行校驗,請稍候…" 
  64.                                     }).defaultPassed(); 
  65. }) 

 

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

弋阳县| 柳州市| 岳西县| 株洲市| 罗定市| 舞钢市| 延吉市| 绍兴县| 东城区| 江津市| 新巴尔虎右旗| 绥棱县| 得荣县| 富川| 包头市| 常州市| 龙游县| 九台市| 濉溪县| 灯塔市| 车致| 广宗县| 大同市| 萍乡市| 陈巴尔虎旗| 龙井市| 肇州县| 巨鹿县| 龙州县| 内乡县| 英吉沙县| 乌鲁木齐市| 通州市| 车致| 涟源市| 东乌珠穆沁旗| 巴林右旗| 成都市| 白山市| 苍南县| 新竹县|