Thanks very much. Elif worked!
On Wednesday, August 22, 2012 10:56:53 PM UTC-6, Anthony wrote:
>
>
>
> form=SQLFORM.factory(
>> Field('your_email',requires=IS_EMAIL()),
>> Field('question',requires=IS_NOT_EMPTY()))
>> if form.process().accepted:
>> if mail.send(to='[email protected]',
>> subject='From %s' % form.vars.your_email,
>> message=form.vars.question):
>> redirect(URL('confirmation'))
>> else:
>> form.errors.your_email='Unable to send email'
>>
>
> When the page is first loaded, the form is created, and then
> form.process() is called. At this point, the form is not accepted because
> nothing has been submitted, so it goes to your else clause, which sets an
> error for the your_email field, which shows up on the form. Instead, you
> probably want:
>
> if form.process().accepted:
> ...
> elif form.errors:
> ...
>
> You might also want to add a condition in case the form is accepted but
> the mail sending itself fails.
>
> Anthony
>
--