I looked into the form wizard, and this worked great for what I was trying 
to do. Thank you!

On Wednesday, December 23, 2015 at 12:54:01 PM UTC-8, aetag...@gmail.com 
wrote:
>
> I have a form that is rather long, therefore I want to split it into 
> sections.
> I am doing this with jQuery conditional fields in forms. 
>
> The first 5 fields appear, once the user enters input for the fields and 
> then they click on a checkbox, the filled fields are then hidden and the 
> next 5 questions are unhidden, and this is repeated every 5 questions. 
>
> I was wondering if there is a way to show the fields again that were 
> hidden after clicking the checkbox, in case the user unchecks the box in an 
> attempt to view the previous 5 questions again. Because what happens now 
> when the box is unchecked is that it hides the fields that it revealed but 
> doesn't show the previous 5 fields unless you uncheck and recheck the box.
>
>
> Also, I am basically repeating the following code from the book:
>
> {{extend 'layout.html'}}
> {{=form}}
> <script>
> jQuery(document).ready(function(){
>    if(jQuery('#taxpayer_married').prop('checked'))
>         jQuery('#taxpayer_spouse_name__row').show();
>    else jQuery('#taxpayer_spouse_name__row').hide();
>    jQuery('#taxpayer_married').change(function(){
>         if(jQuery('#taxpayer_married').prop('checked'))
>             jQuery('#taxpayer_spouse_name__row').show();
>         else jQuery('#taxpayer_spouse_name__row').hide();});
> });
> </script>
>
>
> I have 3 seperate sections of the form, each section has it's own script, 
> showing and hiding 5 form fields within each. I don't understand jQuery all 
> that well, is there a way to make it less repetitive? I'm over 160 lines of 
> code for just showing and hiding fields, I'm hoping there is a better way.
>
>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to