:) For what...
On Tue, Dec 8, 2015 at 2:18 PM, Jonathan R <[email protected]> wrote: > I need to have this radio button, > is there a variable that stores the value of the radio button before > processing the form ? > > On Tuesday, December 8, 2015 at 11:03:40 AM UTC-5, Richard wrote: >> >> You should have a look at web2py auth... I guess no one really need to >> customize login form... There is surely a way to customize it, and you >> seems to have found a way... You may also, ask yourself about why you do >> that and if you really need to do it... Or could it be crafted >> differently... For instance would your user really want to change setting >> at each login?? Maybe you can have a preference profile page for each user >> to them set there prefered way of login... >> >> Richard >> >> On Tue, Dec 8, 2015 at 10:56 AM, Jonathan R <[email protected]> wrote: >> >>> Yes I did, and nothing changed on the login screen, I still had None >>> displayed instead of the radio button. >>> >>> I feel like there is a simple easy way to add a field in the login >>> screen and save it but I can't see it... >>> >>> >>> >>> >>> On Monday, December 7, 2015 at 9:42:51 PM UTC-5, Richard wrote: >>>> >>>> Did you try by simply specify : >>>>> >>>>> Field('radio_button', ..., readable=True, writable=True) >>>>> >>>> >>>> ? >>>> >>>> Richard >>>> >>>> On Mon, Dec 7, 2015 at 5:19 PM, Jonathan R <[email protected]> wrote: >>>> >>>>> I successfully added the radio button i wanted on my login page but >>>>> instead of using a column in the auth_user table I only created a radio >>>>> button that will assign its value in a session variable. To do so I need >>>>> to >>>>> modify the if form.accepts(): block to gather the value on submission but >>>>> I'm not sure where to find this piece of code (or what should be in a >>>>> custom one to keep the authentication process working). >>>>> >>>>> my default.py : >>>>> user(): >>>>> >>>>> if request.args(0)== "login": >>>>> form=auth() >>>>> form.elements()[0].insert(0,LABEL('text1',_class='radioButton')) >>>>> >>>>> form.elements()[0].insert(0,INPUT(_type='radio',_class='radioButton',_value='text1')) >>>>> #same for all values >>>>> >>>>> #frest of the form (username and password) same as Richard >>>>> implementation >>>>> >>>>> return dict(form=form) >>>>> >>>>> [...] >>>>> >>>>> then if I want to gather the data in a session variable I'll have to >>>>> change the behavior of the auth() form on accepts: >>>>> >>>>> if form.accepts(request,session): >>>>> session.radioButtonValue = form.vars.radioButton >>>>> >>>>> but this will stop the auth to process the rest of the form but I >>>>> don't know what are the mandatory steps to add (couldn't locate the >>>>> original auth accepts process) >>>>> >>>>> >>>>> >>>>> On Friday, December 4, 2015 at 4:45:52 PM UTC-5, Jonathan R wrote: >>>>>> >>>>>> Hi everyone, >>>>>> I'm trying to add a radio button on my login form to let the user >>>>>> decide which authentication method he wants to use. >>>>>> >>>>>> I added a field in the auth_user table and i try to display the >>>>>> corresponding radio button in my login page as follow: >>>>>> >>>>>> in bd.py >>>>>> >>>>>> [......] >>>>>> >>>>>> auth.settings.extra_fields['auth_user']=[Field]('choice', >>>>>> requires=IS_IN_SET(['choice 1','choice >>>>>> 2']),widget=SQLFORM.widgets.radio.widget),] >>>>>> >>>>>> auth.define_tables(username=True) >>>>>> >>>>>> >>>>>> [...] >>>>>> >>>>>> in user.html >>>>>> >>>>>> [...] >>>>>> >>>>>> {{form=auth.login()}} >>>>>> >>>>>> [...] >>>>>> >>>>>> {{=form.custom.begin}} >>>>>> Method to Use: >>>>>> {{=form.custom.widget.choice}} >>>>>> </br> >>>>>> Username: >>>>>> {{=form.custom.widget.username}} >>>>>> </br> >>>>>> Password: >>>>>> {{=form.custom.widget.password}} >>>>>> {{=form.custom.submit}} >>>>>> {{=form.custom.end}} >>>>>> >>>>>> >>>>>> [...] >>>>>> >>>>>> This displays correctly the Username and password fields as text and >>>>>> password field but instead of the radio Button the app return None. >>>>>> >>>>>> I checked the db table and the field is created. >>>>>> >>>>>> What am I doing wrong ? >>>>>> >>>>>> Thank you for your help. >>>>>> >>>>>> -- >>>>> 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/d/optout. >>>>> >>>> >>>> -- >>> 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/d/optout. >>> >> >> -- > 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/d/optout. > -- 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/d/optout.

