On Feb 6, 2010, at 12:58 PM, Jonathan Lundell wrote:
> On Feb 6, 2010, at 12:38 PM, mdipierro wrote:
>
>> form[0][-1][1].append(BUTTON(_onclick="...."))
>
> Thanks.
>
> Ideally, I'd like to return to the form.accepts call in such a way that the
> accepts return test can recognize the cancelation and then redirect as
> necessary. Somewhat parallel to testing form.error, I'd test (say)
> form.cancel.
>
> Does that make sense? It seems to me that it might be a useful general
> capability for form processing.
>
> One angle I was thinking of, but haven't investigated, is having multiple
> submit buttons, with accepts() making available the name and/or value of the
> button that was clicked.
>
> That seems more in keeping with the self-submit philosophy, don't you think?
I think I got it to work.
form[0][-1][1].append(INPUT(_type="submit", _name="button",
_value="Cancel"))
and then after calling accepts:
if request.vars.button == "Cancel":
session.flash = 'edit canceled'
else:
session.flash = "edit accepted"
redirect(URL(r=request, f='servers'))
...or something similar in the form.error case. (I find that I'm a little fuzzy
on the various return cases for accepts, though.)
Question: what exactly is form[0][-1][1].append appending to? Can I append more
than once to that same object?
--
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.