You need to use the onvalidation option in SQLFORM to do validation
spanning several columns:
def _validate_other(form):
if form.vars.select_field == 'Other' and not form.vars.other:
form.errors.other = 'Please provide a value'
form = SQLFORM(table, onvalidation=_validate_other)
form.process()...
On Monday, 15 January 2018 15:20:28 UTC, Anthony wrote:
>
> On Monday, January 15, 2018 at 8:15:12 AM UTC-5, Javier Pepe wrote:
>>
>> Hi
>>
>> You can use de conditional show_if
>>
>>
>> http://web2py.com/books/default/chapter/29/07/forms-and-validators#Conditional-fields
>>
>> db,table.text_field.show_if = (db.table.select_field == Other)
>>
>
> This is useful for improving the UI, but it will not force the user to
> enter a value in the text field.
>
> Anthony
>
--
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/d/optout.