On Saturday, January 13, 2018 at 5:23:58 PM UTC-5, vtcpe12 wrote:
>
> Hi,
>
> I am utilizing the IS_IN_SET functionality to produce a select box in my 
> SQLFORM. One of the options is 'Other'. I have another simple text box that 
> I would like to force the user to enter a value for if Other is selected in 
> the select box. Is that possible with the built in validators?
>

You could conditionally set the text field's validator depending on the 
submitted value for the select field:

db.mytable.mytextfield.requires = IS_NOT_EMPTY() if request.vars.myselectfield 
== 'Other' else None

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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to