Doesn't that defeat the purpose of using a form wizard, since I can use 
jquery effectively without it all on the same page?

Or do you mean that the form wizard helps with shortening code with this 
because instead of hiding/showing fields one-by-one, it can somehow allow 
me to do this using the wizard steps as blocks with jquery??

I have looked into jquery and did some excercises on codecadamy, and I 
think I understand it alright..I just don't know how to incorporate it with 
web2py code.

Can you give me some kind of example please?

On Monday, December 28, 2015 at 9:39:18 AM UTC-8, Anthony wrote:
>
> Based on your code, it looks like you are making separate submissions to 
> web2py for each step (encoding the step in the first URL arg) -- in other 
> words, you are loading/submitting a separate page for each step. I was 
> suggesting you handle the entire form via Javascript on a single page, with 
> no submissions until all the steps have been filled.
>
> Anthony
>
> On Monday, December 28, 2015 at 12:17:17 PM UTC-5, [email protected] 
> <javascript:> wrote:
>>
>> I've been trying and failing with trying to get that to work with the 
>> form wizard, it works without it.
>> The conditional fields just don't work at all, the form proceeds as 
>> normal showing every field in every step. I don't know if I am just placing 
>> things in the wrong place or what.
>>
>>  step = int(request.args(0) or 0)
>>     if not step in STEPS: redirect(URL(args=0))
>>     fields = STEPS[step]
>>     if step == 0:
>>         d = 'General Information'
>>         session.myform = {}
>>     if step == 1:
>>         d = 'Day 1'
>>     if step == 2:
>>         d = 'Day 2'
>>     if step == 3:
>>         d = 'Day 3'
>>     if isinstance(fields,tuple):
>>         *db.myform.field2.show_if = (db.myform.field1==True)*
>>         form = SQLFORM.factory(*[f for f in db.myform if f.name in 
>> fields])
>>         
>>         if form.accepts(request,session):
>>             session.myform.update(form.vars)
>>             redirect(URL(args=step+1)) 
>>     else:
>>         db.myform.insert(**session.myform)
>>         session.flash = T('form completed')
>>         redirect(fields)
>>     return dict(form=form,step=step, 
>> d=d)                                                                         
>>                          
>>
>>
>> And then with and without numerous variations:
>>
>> <script>
>> jQuery(document).ready(function(){
>>    if(jQuery('#myform_field1').prop('checked'))
>>         jQuery('#myform_field2__row').show();
>>    else jQuery('#myform_field2__row').hide();
>>    jQuery('#myform_field1').change(function(){
>>         if(jQuery('#myform_field1').prop('checked'))
>>             jQuery('#myform_field2__row').show();
>>         else jQuery('#myform_field2__row').hide();});
>> });
>> </script>
>>
>>
>> It does absolutely nothing no matter how I try implementing it with the 
>> form wizard.
>>
>>
>> On Monday, December 28, 2015 at 8:38:33 AM UTC-8, Anthony wrote:
>>>
>>> You might consider keeping all the wizard steps in a single HTML page, 
>>> and just use Javascript to show/hide the different steps. That way, data 
>>> entered in one step will be retained even as you skip back and forth to 
>>> other steps.
>>>
>>> Anthony
>>>
>>> On Monday, December 28, 2015 at 11:28:49 AM UTC-5, [email protected] 
>>> wrote:
>>>>
>>>> Is it possible to implement something equivalent to a drop down menu 
>>>> within a form wizard?
>>>> I want to display a menu which exists on each page of the form, so that 
>>>> the user can select which step to go to, they can select the step in the 
>>>> menu and it redirects them to that step.
>>>> The problem is that if the user fills out the form in step 1, then they 
>>>> go to another step and return the that previous step the inputted data is 
>>>> gone. I can't find a way around this.
>>>>
>>>> I also only want to display this drop down menu only on the form page, 
>>>> not in the navbar with the other menu items but I can't figure out how to 
>>>> do  it or find anything similar on the web.
>>>>
>>>> Also, the drop-down functionality doesn't seem to work either when I 
>>>> try implementing it, the submenu just shows up in a horizontal list 
>>>> underneath "Go to page", rather than a menu that pops up upon clicking.
>>>>
>>>> *menu.py :*
>>>> response.menu = [
>>>> ##Regular menu here
>>>> ]
>>>>
>>>>              
>>>> DEVELOPMENT_MENU = True
>>>>
>>>> def menu2():
>>>>     menu2= [
>>>>         (T('Go to page'), False, '#', [
>>>>             (T('General Information'), False, URL('default', 
>>>> 'myform/0')),
>>>>             (T('DAY1'), False, URL('default', 'myform/1')),
>>>>             (T('DAY2'), False, URL('default', 'myform/2')),
>>>>             (T('DAY3'), False, URL('default', 'myform/3')),
>>>>               ])
>>>>         ]
>>>>
>>>>
>>>>
>>>> *views/layout.html:*
>>>>           {{if response.menu:}}
>>>>           {{=MENU(response.menu, _class='nav 
>>>> navbar-nav',li_class='dropdown',ul_class='dropdown-menu')}}
>>>>           {{pass}}
>>>>
>>>>
>>>>
>>>> *views/default/myform.html:*
>>>> <h1>Day: {{=d}}</h1>
>>>> {{=form}}
>>>> {{=menu2}}
>>>>
>>>

-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to