Hi, i thought the form worked good, but unfortunally i was wrong. name = form.vars.name contains the data from 'Name', INPUT(_name='name'), but passwords = form.vars.password is always none
here again the code, with the improvements: def login(): form = FORM( 'Name', INPUT(_name='name'), 'password', INPUT(_password='password'), INPUT(_type='submit')) if form.process().accepted: name = form.vars.name passwdb = dba(dba.user.name== name).select(dba.user.password).first () passwords = form.vars.password dba.user.insert(name = 'justtest', password= form.vars.name, email=form .vars.password, country= form.vars.name) if passwdb == passwords: redirect(URL('index')) else: redirect(URL('register')) return dict(form=form) Am Sonntag, 19. Januar 2014 19:28:23 UTC+1 schrieb Lucas Schreiber: > > Hi guys, > > i have this function: > > def login(): > form = FORM( > 'Name', INPUT(_name='name'), > 'password', INPUT(_password='password'), > INPUT(_type='submit')) > if form.process().accepted: > name = form.vars.name > records = SQLTABLE(dba(dba.user.name== name).select(dba.user. > password),headers='fieldname:capitalize') > passworddb = records[1] > password = form.vars.password > dba.person.insert(name = 'test', email=password) > if passworddb == password: > redirect(URL('register')) > else: > redirect(URL('index')) > > return dict(form=form) > > > As you can see, you enter name and password into a form, and from a db it > choose a password correspondending to the username. that part works fine. > but the problem is on the part: > > password = form.vars.password > > i think this doesnt work, since the line below > > > dba.person.insert(name = 'test', email=password) > > inserts into another db "test", "none" > > Do anyone has an idea how to fix this problem? Or can anyone tell me what > i did wrong? > > Thanks for the help, > Darren > -- 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/groups/opt_out.