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, aetag...@gmail.com > <javascript:> 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.