Re: [web2py] Re: Computing a field from the value of another field

2011-09-11 Thread Chris Rowson
Thank you everyone for the advice. Chris On Sep 11, 2011 4:47 AM, "pbreit" wrote: > Good point.

[web2py] Re: Computing a field from the value of another field

2011-09-10 Thread pbreit
Good point.

[web2py] Re: Computing a field from the value of another field

2011-09-10 Thread Massimo Di Pierro
I do this. auth.settings.extra_fields['auth_user'] = [Field('city'),Field('country')] def lola(form): if form.vars.institution_country: form.vars.longitude, form.vars.latitude = geocode("%s %s" % (form.vars.city, form.vars.country)) auth.settings.register_onvalidation=lola auth.sett

[web2py] Re: Computing a field from the value of another field

2011-09-10 Thread Anthony
On Saturday, September 10, 2011 9:35:17 PM UTC-4, pbreit wrote: > > Maybe even a computed field? > http://web2py.com/book/default/chapter/06#Computed-Fields > Yes, I suppose that's not a bad idea, though in this case, I guess that would require calling the geocoding function twice -- once for the

[web2py] Re: Computing a field from the value of another field

2011-09-10 Thread pbreit
Maybe even a computed field? http://web2py.com/book/default/chapter/06#Computed-Fields You might want to store the postcode and check it to see if the new one is different before geocoding it.

Re: [web2py] Re: Computing a field from the value of another field

2011-09-10 Thread Anthony
On Saturday, September 10, 2011 6:51:51 PM UTC-4, leftcase wrote: > > Cool, Thanks Anthony! > > Does the onvalidation option have benefits over and above the way I've done > it. > I guess it's a bit simpler because it still allows form.accepts() to handle the DB insert, so you don't have to do it

Re: [web2py] Re: Computing a field from the value of another field

2011-09-10 Thread Chris Rowson
Cool, Thanks Anthony! Does the onvalidation option have benefits over and above the way I've done it? Chris > Another option might be using an onvalidation function: > http://web2py.com/book/default/chapter/07#onvalidation > Anthony > > On Saturday, September 10, 2011 4:37:08 PM UTC-4, leftcase

[web2py] Re: Computing a field from the value of another field

2011-09-10 Thread Anthony
Another option might be using an onvalidation function: http://web2py.com/book/default/chapter/07#onvalidation Anthony On Saturday, September 10, 2011 4:37:08 PM UTC-4, leftcase wrote: > > Hi there, > > I bought the web2py .pdf, and have been reading it, but I'm struggling > a little bit with: >

[web2py] Re: Computing a field from the value of another field

2011-09-10 Thread Chris Rowson
> Hi there, > > I bought the web2py .pdf, and have been reading it, but I'm struggling > a little bit with: > > http://www.web2py.com/book/default/chapter/07#SQLFORM > > Specifically the section "SQLFORM without database IO" > > I have 2 fields, lon & lat I'd like to calculated from a postcode and