$(":input") ? On Thursday, November 29, 2012 2:29:46 AM UTC+1, Daniele wrote: > > Hello all :) > I have a db.define_table that defines a particular role and all its > fields. One of the fields is a boolean, which will display as a checkbox in > the SQLFORM. > > What I'd like to do is hide ALL the elements in the SQLFORM if the > radiobutton is unchecked, and show all the elements if it's checked. > So I have something like this: > > <script> > jQuery(document).ready(function(){ > jQuery('#tutor_biography__row').hide(); > jQuery('#tutor_is_tutor').change(function(){ > if(jQuery('#tutor_is_tutor').attr('checked')) > jQuery('#tutor_biography__row').show(); > else jQuery('#tutor_biography__row').hide();}); > }); > </script> > > > What I'd like to do is not just hide one field, but hide all the fields if > the radio button is unclicked. > Is there a shortcut to do this or must I input all the rows manually? > > Also, another thing I'd like to add in the jQuery is, if the radio button > was checked, filled out, and then unchecked, I want the values to not be > stored but to be erased. I assume I'd have to add something like .val('') > but I'm not sure where to do that. > > Thanks! >
--