Hi,
I am re-posting this question, for some reason i don't see my earlier post
in this forum.
I have a form with 2 fields for search, one text, other drop-down. I want
the users to be able to type in the free text or choose from drop-down or
both.
form = SQLFORM.factory(Field('address', label='Address'),
Field('ugroup', requires=IS_IN_DB(db, db.t_ugroups,
'%(group_desc)s'), label='User group'),
formstyle="divs", submit_button="Search"
)
I have a custom form validator to check that both are not null.
def check_search(form):
if (not form.vars.ugroup) and (not form.vars.address):
form.errors.ugroup = 'Need input on user group or address'
The problem is the IS_IN_DB kicks in and throws an error "value not in
database" if only address is typed and searched.
How do i overwrite the IS_IN_DB validator with my custom validator?
Thanks,
Yogesh
--
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.