EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: zlyc on February 10, 2015, 01:36:13 AM



Title: ComboBox Extend Validation Dont Work In IE [Resolved]
Post by: zlyc on February 10, 2015, 01:36:13 AM
Hi,

  I have manual validation piece of code working in chrome/firefox but not in IE. The code suppose to show "The entered value does not exists." if non of the value type in combobox is part of the combobox list.

   How can make it workable in IE (error msg : cbbank is undefined, File: eval code (47), Line: 1, Column: 1)

              // JavaScript
      $.extend($.fn.validatebox.defaults.rules,{
          exists:{
              validator:function(value,param) {
                  var cc = $(param[0]);
                  var v = cc.combobox('getValue');
                  var rows = cc.combobox('getData');
                  
                  for(var i=0; i<rows.length; i++) {
                      if (rows.bankName == v){return true}
                  }
                  return false;
              },
              message:'The entered value does not exists.'
          }
      });
                // HTML
         <input id="cbbank" name="bank" class="easyui-combobox" style="width: 350px;" value="${sp.bankName }"
               data-options="valueField:'bankName',
                         textField:'bankName',
                    validType: 'exists[cbbank]',                                                              
               url:'${createLink(controller:'serviceProviders', action:'bankList')}',
               mode:'remote',
               editable:true" />   
Thanks


Title: Re: ComboBox Extend Validation Dont Work In IE
Post by: stworthy on February 10, 2015, 07:57:31 AM
Please try to use the code below instead.
Code:
<input id="cbbank" name="bank" class="easyui-combobox" style="..."
data-options="
validType:'exists[\'#cbbank\']',
...
">


Title: Re: ComboBox Extend Validation Dont Work In IE
Post by: zlyc on February 10, 2015, 07:56:25 PM
Work like charm!. Thanks.  :)