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.settings.profile_onvalidation=lola On Sep 10, 9:01 pm, Anthony <abasta...@gmail.com> wrote: > 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 lon field > and once for the lat field (since each field will need its own compute > function). Since the function involves a call to Google's servers, that may > introduce more delay than you want (though perhaps the function could cache > the longitude and latitude, so when the second field's compute function is > called, it fetches from the cache instead of hitting Google again). > > Anthony