You need to use form.custom.widget.fieldname to get the errors to display
automatically. If you create your own <input> tags manually in HTML, then
you'll have to manually include the errors as well (the error for a given
field is in form.errors.fieldname). Maybe something like:
<input type="text" name="email" class="span3" placeholder="Email-adres…"
required="required" tabindex="1">
{{=DIV(form.errors.email, _class='error') if form.errors.email else ''}}
Anthony
On Wednesday, November 6, 2013 3:35:05 PM UTC-5, Ruud Schroen wrote:
>
> Hi,
>
> I am building my login form with the form.custom.widget, because I don'
> like the standard layout of the forms.
> Now the problem is, I can't get the errors to display.
>
> Here is my controller:
> def login():
> form=auth.login()
> if form.accepts(request,session):
> response.flash = 'form accepted'
> elif form.errors:
> response.flash = 'form has errors'
> else:
> response.flash = 'please fill the form'
> return dict(form=form)
>
> And my view:
> {{=form.custom.begin}}
> <div class="login_form">
> <h2>INLOGGEN</h2>
> <label>E-Mail<sup>*</sup></label>
> <input type="text" name="email" class="span3"
> placeholder="Email-adres…" required="required" tabindex="1">
> <label>Wachtwoord<sup>*</sup></label>
> <input type="password" name="password" class="span3"
> placeholder="Wachtwoord…" required="required" tabindex="3">
> </div>
> <div class="pull-left">
> <input type="submit" class="btn pull-right" style="margin-top:
> 15px;" value="Login">
> </div>
> {{=form.custom.end}}
>
> Acording to the book, the errors should display by themself, but they
> don't. What am i doing wrong?
>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.