jquery validation -


i using jquery validation follow

var validator=$("#myform")     .validate({         rules: {                    field1: { required: true },                    field2: { required: true },                    field3: { required: true },                    field4: { required: true }              } }); 

field1, field2 in tab0 , field3,field4 in tab1

if click in tab1 without fill field1, field2 , fill field3, field4 validation true.

i guess in case field1,field2 hidden because of tabs.

here form

<form  id="myform"  enctype="multipart/form-data" method="post" action="myaction.php" >     <div id="tabs">         <ul>             <li><a href="#tab-1">tab1</a></li>             <li><a href="#tab-2">tab2</a></li>         </ul>      <div id="tab-1">           <input type="text" name="field1" id="field1" />              <input type="text" name="field2" id="field2" />          </div>      <div id="tab-2">           <input type="text" name="field3" id="field3" />              <input type="text" name="field4" id="field4" />          </div>     </div>      <button type="submit" name="save">                 <img src="/admin/graphics/icons/disk.gif" alt=""/>save     </button>     </form> 

how can solve this.any suggestion welcome


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -