Thursday, 15 September 2011

jQuery Accordion Form Validation , Sub Selection -



jQuery Accordion Form Validation , Sub Selection -

i new jquery , finding hard implement accordion type form.

the form has selection box 3 selections. if 1 of selections selected more fields revealed. problem here when add together class="required" field hidden fields, regardless of if hidden or not still required.

my function @ moment consists of:

$(function() { $( "#myform" ).validate({ rules: { accordionfield: { required: true } }, ignore: [] }); });

and not sure how create fields appear after selection required, , not other hidden fields.

<div class="row"> <div id="radio"> <input type="radio" id="radio1" name="option" value="1" class="required"/><label for="radio1">optionone</label> <input type="radio" id="radio2" name="option" value="2" class="required" /><label for="radio2">optiontwo</label> <input type="radio" id="radio3" name="option" value="3" class="required" /><label for="radio3">optionone</label> </div> </div> // if radio 1 selected option2 displays, radio 2 option2 , on <div id="option1" class="desc" style="display: none;"> <input name="name" type="text" class="required"> </div> <div id="option2" class="desc" style="display: none;"> <input name="sonsname" type="text" class="required"> </div> <div id="option3" class="desc" style="display: none;"> <input name="daugtersname" type="text" class="required"> </div>

just sumarize, want 1 of fields name, sonsname, daugtersname required based on if take optionone, optiontwo, or alternative 3 in radio box.

jquery jquery-validate accordion

No comments:

Post a Comment