On Mar 2, 2011, at 12:27 AM, annet wrote:
> 
> Hi Denes,
> 
> Thanks for your reply, removing the else: ... solved the problem. I
> followed the if: .. elif: .. else: .. pattern used in the chapter on
> forms and validators in the web2py manual. Why does it work in a
> single form function and why doesn't it work in a multiple form
> function?

While you can put as many forms as you like on the page, the user can submit 
only one at a time. The else clause is invoked when you see a form that hasn't 
been submitted. 

So if the user submits your first form, you'll put something appropriate in 
response.flash, but you'll execute the else cause for the second form and 
clobber it.

> 
> 
>> Since you are not redirecting after an accepts it just comes back to
>> the same controller, creating new forms and resetting the
>> response.flash messages.
> 
> Should I redirect after an accepts? The view has a two column layout,
> the left column contains a search form the right column displays the
> search results.

Don't redirect unless the flow of your logic requires it. But go over your 
logic keeping in mind that at most only one form at a time will be submitted.


> 
> 
> Hi Jonathan,
> 
> Thanks for your reply. I added the response.flash='Fill in form' line
> of code before the first call to accepts, the actual text contains
> more than just the 'Fill in form' directive.
> 
> 
> Kind regards,
> 
> Annet.


Reply via email to