Something is wrong here. What are you trying to do? Add a field to 
registration form? Why not use

auth.settings.extra_fields['auth_user'] = Field('f_zipcode', 
requires=IS_LENGTH(3,5))

On Wednesday, 27 January 2016 09:39:22 UTC-6, Spokes wrote:
>
> I've manually added a field to the auth.register() form, but validation is 
> not performed for the field upon form submission. The code is as follows:
>
> def create_zipcode_field_for_register_form():
>     input_zipcode = INPUT(_class = 'span4 string', _name = 'f_zipcode', 
> _id = 'f_zipcode', 
>                           _placeholder = T('Recommended'), requires = 
> IS_LENGTH(5, 3))
>
>     div_password_confirm_controls = DIV(input_zipcode, SPAN(_class = 
> 'help-block'), _class = 'controls')
>     
>     label = LABEL(T('ZIP'), _class = 'control-label')
>     return DIV(label, div_password_confirm_controls, _id = 
> 'f_zipcode__row', _class = 'control-group')
>
> def custom_register():
>    ...
>    auth.settings.formstyle = 'bootstrap'
>    form = auth.register() 
>    form.element('#auth_user_username__row', replace = lambda x: x + 
> create_zipcode_field_for_register_form())
>    return dict(...)
>
> Is there a way to force the validation to be performed for the 'f_zipcode' 
> input?
>
> The 'f_zipcode' field pertains to a table other than auth_user, and I'd 
> like to avoid the 'auth.settings.extra_fields' route of solving this 
> problem. 
>

-- 
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