howto processing dynamic forms when update

15 views
Skip to first unread message

Erwn Ltmann

unread,
Feb 13, 2015, 5:13:14 AM2/13/15
to web...@googlegroups.com
hi everybody,

been starting with web2py weeks ago and now my first unsolved issue appears.

There is an action to handle a custom form (as skeleton code here):

form = FORM()

for row in some_data_source:
  if row in relevant_data_source:
    form.append( INPUT(...var...) )

if form.accepts(...):
  for v in form.vars[...var...]:
    ... change relevant_data_source ...

So far the skeleton code. Now the issue: i have to call twice this action because first relevant_data_source will be updated in accepts block and after then creation of form will be effected. But i can't twist the code because i need values of input vars.

thx for helping


Niphlod

unread,
Feb 13, 2015, 2:47:16 PM2/13/15
to web...@googlegroups.com
that doesn't really make sense....

"""
i have to call twice this action because first relevant_data_source will be updated in accepts block
"""
What you're stating is - actually - that you need two separate logics (and forms): in order to create - and validate - the second, you need the user to fill in some details in the first one.... why don't you just use two forms with a redirect between the first and the second, or some kind of flag (i.e. step=1 in the first, step=2 in the second) ?

Reply all
Reply to author
Forward
0 new messages