Hello mate,
Using Auth when I customize the form (which means I don't use {{=
form}}) on the views the validation "IS_NOT_IN_DB" doesn't seems to
work and any other validation as well...
For example on the registration view page:
instead of using:
{{=form}}
I use a custom form something like:
<form>
first Name: <input class="string"
id="auth_user_first_name" name="first_name" type="text"
value="{{=form.latest.first_name}}" />
email: <input class="string" id="auth_user_email"
name="email" type="text"
value="{{=form.latest.email}}" />
...
...
{{=form.hidden_fields()}}
</form>
Using the custom form on view I can register several users with the
same email which is not good since the table is define to not do so...
using {{=form}} in the view there is an error message (Everything
works as expected)
So I tried to create a custom validation in my action that verify if
the email is already in the DB and if yes raise an error...
Here is my code in the controller:
def register():
if form.accepts(request.vars,formname='register'):
user = self.db(db.auth_user.email==request.vars.email.strip
()).select()
if user:
session.flash = 'Already In the DB Sorry'
next = URL(r=request, f='register')
redirect(next)
......
......
Using this custom validation, it doesn't work I still can register
several users with the same email...
Do you please have any idea how to resolve this issue ? am I doing
something wrong ?
Thanks for your attention,
Yannick P.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" 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
-~----------~----~----~----~------~----~------~--~---