$("form").validate( { rules: { legal_status_comment: { required: function(element) { return $ ("[name=legal_status]:checked").attr("id") == "other_radio"; } } } });
On Jan 12, 3:43 am, jeffself <jeff.s...@gmail.com> wrote: > I've got a form with a radio group called 'legal_status'. There are > five radio buttons. The last one has an id='other_radio'. If this > button is selected, I have a textarea field that gets displayed. The > field has an id='legal_status_comment'. This textarea field is wrapped > by a div with an id='other_text_area' that is hidden until the > other_radio button is selected. > > How do I write the rule to make the 'legal_status_comment' field to be > required if the 'other_radio' button has been selected? > > Thanks!