Hi!

I'm validating a self referencing field via onvalidation parameter of
crud.update(). My function checks if this field is the same as the id
and emits an error in this case (setting form.errors.ref_field). (form
is the parameter for the function given to onvalidation)

I read the example to onvalidation on http://web2py.com/book/default/section/7/1
(7.1. FORM) and it is using form.vars to access the fields of the
form. But form.vars is empty. I found my values in form.request_vars
and was able to successfully check form.request_vars.ref_field ==
form.request_vars.id.


Could be an error in the book, or maybe CRUD is different from FORM.
Haven't looked any further into this matter.

BTW: The section on CRUD http://web2py.com/book/default/section/7/6
refers to SQLFORM for an explanation for onvalidation, but
onvalidation isn't mentioned on http://web2py.com/book/default/section/7/2
7.2. SQLFORM


Regards,
Stefan

Reply via email to