Assuming you are using the default SQLFORM formstyle, which is table.
Use Firebug or similar to look at the id SQLFORM assigns to the table rows
and table cells. Also look at the class SQLFORM assigns to the table,
table rows and table cells.
You will notice a pattern. Set up your custom form to follow the same
pattern and the javascript that works on the SQLFORM should also work on
your custom form.
I recommend Firebug because it's easier to see the patterns than looking at
the source code.
On Thursday, May 2, 2013 10:48:11 PM UTC-4, 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.