form.accepts(...,onvalidation=lambda form: form.vars.newfield='value')

On Jan 23, 11:56 am, leone <handja...@gmail.com> wrote:
> Sorry.
> How can I force a value in a field of SQLFORM.factory after its
> validation?
> Thanks
> leone
>
> On 22 Gen, 20:03, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > I still do not understand. I want to know what you try to accomplish,
> > not how you do it.
>
> > On Jan 22, 12:38 pm, leone <handja...@gmail.com> wrote:
>
> > > Very simple:  IS_AUTONUMBER return an incremental value.
> > > It runs well if I use SQLFORM with a db  linking the validator to a
> > > field before
> > > calling SQLFORM, so I view the value in the form.
> > > But using SQLFORM.factory I obtain the correct value in form.vars
> > > object, but I want
> > > to see it on the screen too and I dont' understand how!
> > > Probably is very simple, but i have no idea ...
> > > Thanks
> > > leone
>
> > > On 22 Gen, 18:34, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > > > Not sure I understand what this supposed to do. Would you explain it
> > > > once more.
>
> > > > On Jan 22, 10:47 am, leone <handja...@gmail.com> wrote:
>
> > > > > I suppose that my error is in setting the new value to field.
> > > > > I am confused.
>
> > > > > def index():
> > > > >     form = SQLFORM.factory (
> > > > >             Field('autonumber','integer', requires=IS_AUTONUMBER
> > > > > (progfile, 10000)),
> > > > >             )
> > > > >     def upd_auto(form):
> > > > >         form.custom.autonumber = form.vars.autonumber
> > > > >     if form.accepts(request.vars, session, keepvalues=True,
> > > > > onvalidation=upd_auto):
> > > > >         pass
> > > > >     return dict(form=form)
>
> > > > > Thanks
> > > > > leone
>
> > > > > On 22 Gen, 17:34, DenesL <denes1...@yahoo.ca> wrote:
>
> > > > > > Can you post your code?
>
> > > > > > On Jan 22, 11:14 am, leone <handja...@gmail.com> wrote:
>
> > > > > > > I done it, but when I update forms.vars.xxxx with the new value 
> > > > > > > it is
> > > > > > > not update in the form.
> > > > > > > Have you a suggest?
> > > > > > > leone
>
> > > > > > > On 22 Gen, 17:03, DenesL <denes1...@yahoo.ca> wrote:
>
> > > > > > > > If I understand correctly you could use onvalidation.
> > > > > > > > Example:
>
> > > > > > > > def your_action():
>
> > > > > > > >   def funcx():
> > > > > > > >     # code that runs after validation
>
> > > > > > > >   ...
> > > > > > > >   if form.accepts(..., onvalidation=funcx):
> > > > > > > >     ...
>
> > > > > > > > On Jan 22, 10:51 am, leone <handja...@gmail.com> wrote:
>
> > > > > > > > > I have a SQLFORM.factory with a Field that requires a custom 
> > > > > > > > > class to
> > > > > > > > > incremet a value.
> > > > > > > > > It runs, but I can't understand how I can udate the field 
> > > > > > > > > value after
> > > > > > > > > form.accepts  and before form is exposed.
> > > > > > > > > Have same example?
> > > > > > > > > Thanks
> > > > > > > > > leone
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.

Reply via email to