authentication - I would like to add radio button in web2py auth -
hi having trouble adding radio button in web2py auth.
as know web2py has built-in login feacture auth().
in db.py,
i add following
from gluon.tools import auth auth = auth(db) auth.settings.extra_fields['auth_user']= [field('status')] auth.define_tables(username=true)
this gives me additional text box called "status" change field, user can chooses either "student" or "tutor".
thanks guys.
when defining field, can specify form widget validator. in case:
field('status', requires=is_in_set(['student', 'tutor']), widget=sqlform.widgets.radio.widget))
by default, if specify is_in_set
validator, <select>
widget in form, above overrides default widget explicitly setting radio widget.
Comments
Post a Comment