The problem seems to be your selector on jQuery. When using SQLForm it 
generates a table for you and you are hiding/showing a table 
row, jQuery('#no_table_band__row').

On your custom form, you don't have that row, hence it won't work, but you 
should have that field and the selector would be jQuery('#no_table_band'). 
This should work unless you are not outputting the field itself with 
=form.custom.widget.YOURFIELD (I don't see it in your view).

As others said, the best approach is to inspect the generated code.

Fabiano.

On Thursday, May 2, 2013 11:48:11 PM UTC-3, Josh Myers wrote:
>
> Hey Group,
>
> I am new to web2py and I am working to create a custom form from the 
> SQLForm.Factory with a conditional field built in.  
>
> I have two questions.
>
> 1.  Using a conditional field based on the checkbox, I can get it to work 
> if I don't use the custom form, but I can't get it to work with the custom 
> form.  Below is my code in the view.
>
> {{extend 'layout.html'}}
> {{=form.custom.begin}}
> <b> Set Model Options </b>
> <div> Model Name: {{=form.custom.widget.GAWR_Model_Name}} </div>
> <div> Sales Set: {{=form.custom.widget.Sales_Set}} </div>
> <b> Determine the Bandwidth </b>
> <script>
> jQuery(document).ready(function(){
>    jQuery('#no_table_band__row').hide();
>    jQuery('#no_table_CV').change(function(){
>         if(jQuery('#no_table_CV').attr('checked'))
>             jQuery('#no_table_band__row').show();
>         else jQuery('#no_table_band__row').hide();});});             
> </script>
> <div> {{=form.custom.widget.CV}} Manually Set the Bandwidth (default is 
> Cross Validation) </div>
> {{=form.custom.submit}}
> {{=form.custom.end}}
>
> 2.  I would like to be able to make a conditional field based on something 
> other than a checkbox, like the value of a set of radio buttons, multiple 
> checkboxes, or a standard select dropdown.  In the latter case, a User 
> would select a certain value in a dropdown and then another dropdown would 
> appear based on the value the User chose.  Can you point me toward any 
> resources on how to do that?
>
> Thank you.
>
> - Josh
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to