Hi, I have two scenario that require manual validation - Adding a new record and updating existing record. Record only has two fields. It is an associative table for many-to-many relationship. I need to ensure that this pair is unique (I considered using primarykey=['task', 'owner'] - but it has other problems)
Since the validation is same, i thought I could use the same function for both new/update. The validation works for "new" but doesn't work for update. I allow only 'owner' to be modified - 'task' is shown on the form but it is read-only. After some digging I found that, form.vars does not have 'task' -read-only field from the form. Is there a way get the read-only field from "form" object ? Any other suggestions for ensuring that task/owner pair is unique during update ? -Mandar On Wednesday, September 5, 2012 12:50:28 AM UTC+5:30, rochacbruno wrote: > > this: > > def validate_my_form(form) > if form.vars.channel == "foo": > form.errors.channel = "This channel is not valid" > > if form.process(onvalidation=validate_my_form).accepted: > # do whatever here > > > > > *Bruno Cezar Rocha** - @rochacbruno* > [email protected] <javascript:> | Mobile: +55 (11) 99210-8821 > www.CursoDePython.com.br | www.rochacbruno.com.br > Blog: Using Python to get all the external links from a > webpage<http://rochacbruno.com.br/using-python-to-get-all-the-external-links-from-a-webpage/> > Get a signature like this. > <http://r1.wisestamp.com/r/landing?promo=18&dest=http%3A%2F%2Fwww.wisestamp.com%2Femail-install%3Futm_source%3Dextension%26utm_medium%3Demail%26utm_campaign%3Dpromo_18> > Click > here.<http://r1.wisestamp.com/r/landing?promo=18&dest=http%3A%2F%2Fwww.wisestamp.com%2Femail-install%3Futm_source%3Dextension%26utm_medium%3Demail%26utm_campaign%3Dpromo_18> > > > > > On Tue, Sep 4, 2012 at 4:09 PM, Daniel Gonzalez > <[email protected]<javascript:> > > wrote: > >> Something like this: >> >> if form.process().accepted: >> if request.var.channel == 'voicemail': validate requests.var.destination >> as a mail address. >> elif request.var.channel == 'sipaddress' validate >> requests.var.destination >> as a sip address. >> elfi request.var.channel == 'phone' validate requests.var.destination >> as a telephone number >> >> >> I have two questions: >> > > > --

