from: 
http://www.web2py.com/books/default/chapter/29/07/forms-and-validators#Database-validators

Validators with dependencies

Usually validators are set once for all in models.

Occasionally, you need to validate a field and the validator depends on the 
value of another field. This can be done in various ways. It can be done in 
the model or in the controller.



There is an example validation done in controller but there is no example 
validation done in model

My table:

db.define_table('config',
    Field('config_name', 'string', length=255, required=True, unique=True),
    Field('convert_option', 'string', length=255,
        requires=IS_IN_SET(CONVERSION, zero=None)),
    Field('config_value', 'string', length=255, required=True),
    Field('default_value', 'string', length=255, required=True))

I want to validate if config_value is greater than default value (for 
example), but i don't want to do it in SQLFORM or FORM.

or is it a bad idea to put validation that depend on other fields in 
"model" rather than form?

Thank you

Hadi

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to