Yes. Are you saying that isn't working? Note, in this case, because you are using the FORM and INPUT helpers rather than SQLFORM, you can simply set the _value attribute directly:
INPUT(_name='phone', type='string', _value=smsNumber, requires=IS_NOT_EMPTY ()) Anthony On Tuesday, July 14, 2015 at 8:21:42 AM UTC-4, dt0...@gmail.com wrote: > > Hi. > > I can't see my last post, so can't add to the thread. > but is this the correct way to do it: > adding the form.var.phone before the accept? > > def testform(): > record = db(db.config.type=="SMS_NUMBER").select(db.config.txt).first() > smsNumber = record.txt if record else '' > > form=FORM('Phone Number:', > INPUT(_name='phone', type='string', requires=IS_NOT_EMPTY()), > INPUT(_type='submit')) > form.vars.phone = smsNumber > if form.accepts(request,session): > response.flash = 'form accepted' > > db.config.update_or_insert( > db.config.type=='SMS_NUMBER', > type='SMS_NUMBER', > txt=form.vars.phone > ) > > elif form.errors: > response.flash = 'form has errors' > return dict(form=form) > > -- 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.