I ended up putting them in separate divs and hiding the entire div. Works like a charm! Thanks guys
On Thursday, November 29, 2012 4:44:50 PM UTC, Anthony wrote: > > The easiest way is probably via a custom form: > http://web2py.com/books/default/chapter/29/07#Custom-forms. > > Another option -- each table row or div containing a field input has an id > that starts with "[tablename]_", so you could use a jQuery selector like: > > jQuery('[id^=tutor_]').hide() > > That will hide all table rows whose id's start with "tutor_", which should > be all the field inputs in the form. > > Anthony > > On Thursday, November 29, 2012 11:07:46 AM UTC-5, Daniele wrote: >> >> I could do that. Would I need to add the div directly in the controller >> or the view? My controller looks something like this now: >> >> def mypage(): >> form = SQLFORM(db.mytable) >> return dict(form=form) >> >> I guess there should be a way to edit the SQLFORM to add an extra div? >> Thanks guys >> >> On Thursday, November 29, 2012 3:50:25 PM UTC, Anthony wrote: >>> >>> Maybe you could put all the fields inside a div and then hide/show the >>> whole div. >>> >>> Anthony >>> >>> On Thursday, November 29, 2012 7:45:22 AM UTC-5, Daniele wrote: >>>> >>>> Hmm, that gets rid of the input boxes but not of the fieldnames as >>>> well. I guess I'll have to do it manually for each field. >>>> >>>> >>>> >>>> On Thursday, November 29, 2012 9:40:29 AM UTC, Niphlod wrote: >>>>> >>>>> $(":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! >>>>>> >>>>> --

