Hello!

I have set a field to "unique=True", it is a generated "unique id". I write 
in quotes because there are no guarantees, although there is a slim chance 
that a generated id is repeated. In the rare case that it happens, it would 
raise a form.error

My question is, how do I "regenerate" the id when the form.error arises?

I tried:
form = SQLFORM(db[tablo])
if form.process().accepted:
   response.flash = 'form accepted'
elif form.errors:
   form.vars.gen_uid = gen_uid(4) #this is the function to generate an id
   response.flash = 'form has errors'
else:
   response.flash = 'please fill out the form'
return dict(form=form)


But doing the above doesn't change the value of the field "gen_uid"

I appreciate 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.

Reply via email to