You can use the 'onvalidation' 
callback: http://web2py.com/books/default/chapter/29/7#onvalidation

form.process(..., onvalidation=my_form_calculation)

You can also define a custom validator for the field to calculate and 
return the transformed value -- 
see http://web2py.com/books/default/chapter/29/7#Custom-validators.

Finally, if you want to do something with the submitted vars before 
validation, you can access the vars in request.vars.

Anthony

On Monday, January 2, 2012 7:39:46 PM UTC-5, Adrian Edwards wrote:
>
> to expand on this a bit, I tried to put the calculations before the 
>  if form.process().accepted: 
>
> but I haven't been able to figure out how to access the value entered 
> by the user. 
> So this may just be as simple as accessing something like 
> form.custom.widget.value 
>
>
> Adrian. 
>
> On Jan 2, 7:35 pm, Adrian Edwards <[email protected]> wrote: 
> > Hello all, 
> > 
> > I have a page where a user enters in some data, and then some 
> > calculations need to occur before the data is put into the database. 
> > 
> > Right now I have 
> >    form = SQLFORM(db.entries, entry) 
> > and whatever the user enters is successfully put into db.entries. 
> > So now I want to do the calculations before populating the database, 
> > but not sure how. 
> > 
> > Any suggestions? 
> > 
> > Thanks. 
> > Adrian

Reply via email to