Hi,
What I plan to do is, changing my form in my view according to
selected option without pushing a button.
I mean, when I change my option, the form must change. And by default
first option is selected also... How can I change my below code to
make it dynamic? Or do you have any suggestions?
Assume I have a select box with options [x,y,z]
def index():
values= ['x','y','z']
options = (TABLE(FORM(TR('Forms: ', SELECT
(values,_name='values')))))
if request.vars.instrument=='x':
form = FORM(INPUT(_name='visitor_name',requires=IS_NOT_EMPTY
()),
INPUT(_type='submit'))
if request.vars.instrument=='y':
form = FORM(INPUT(_name='visitor_name',requires=IS_NOT_EMPTY
()),
INPUT
(_name='visitor_name2',requires=IS_NOT_EMPTY()),
INPUT(_type='submit'))
if request.vars.instrument=='z':
form = FORM(INPUT(_name='visitor_name2',requires=IS_NOT_EMPTY
()),
INPUT
(_name='visitor_name3',requires=IS_NOT_EMPTY()),
INPUT(_type='submit'))
return dict(form=form, options=options)
In my view:
{{extend 'layout.html'}}
{{=options}}
{{=form}}
Best wishes...
--
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en.