On 08/02/2012 11:35 AM, Massimo Di Pierro wrote:
if you have two forms in one page, web2py needs to be able to
discriminate which one is being submitted. It does that by using a
input type=hidden name=formname.

But the forms below have the same name.  I don't
think I understand completely.

Massimo

On Thursday, 2 August 2012 13:13:10 UTC-5, Toby Shepard wrote:

In the forms section:

It is possible to have multiple forms per page, but you must allow
web2py to distinguish them. If these are derived by SQLFORM from
different tables, then web2py gives them different names
automatically; otherwise you need to explicitly give them different
form names. Here is an example:


def two_forms(): form1 = FORM(INPUT(_name='name',
requires=IS_NOT_EMPTY()), INPUT(_type='submit')) form2 =
FORM(INPUT(_name='name', requires=IS_NOT_EMPTY()),
INPUT(_type='submit')) if
form1.process(formname='form_one').accepted: response.flash = 'form
one accepted' if form2.process(formname='form_two').accepted:
response.flash = 'form two accepted' return dict(form1=form1,
form2=form2)


Does it matter at all that both of the forms have the same NAME
attribute? I would have thought that to be poor HTML practice.

Thanks,

Toby

--




--



Reply via email to