I want to have an extra field in the register form but not in the auth_user
table.
There has been some threads about this topic in the past.

In user.html I have added:

elif request.args(0)=='register':
    form[0].insert(-1, DIV(
         LABEL(T('registercode'),_class="control-label col-sm-3"),
         DIV(
              INPUT(_name='registercode', _placeholder="z.B. xs5trv",
_class="form-control string"),
              SPAN(_class="help-block"),
              _class="col-sm-9"),
         _class="form-group"))
pass
=form

​and in db.py there is a simple validation code:

def validate_registercode(form):
    print "reg", form.vars
    if form.vars.registercode!="123":
        form.errors.registercode="*** Error ***"

auth.settings.register_onvalidation=[validate_registercode]

​This creates a nice form containing the new field "registercode". auth
calls the validate_registercode, but form.vars does not contain the new
field "registercode", only the fields last_name, first_name and so on. What
is wrong?

And: is there a better way to add a new field *together with its classes*?

​R
​egards, Martin​

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to