http://web2py.com/books/default/chapter/29/07/forms-and-validators#Conditional-fields

On Monday, February 8, 2016 at 8:50:40 PM UTC-5, Ron Chatterjee wrote:
>
> Wondering if there is a way to keep certain fields within a table be 
> hidden based on checkbox entry in a field. For example, in the table below, 
> I would like the Budget field to be hidden until someone click on weekly 
> checkbox in frequency field. In other words, Budget fields doesn't show up 
> initially till someone click on weekly checkbox and then the field become 
> readable and writable. Possible?
>
> db.define_table("shopping",
>                 Field("Description", "text", label='Summary 
> Description*',requires=IS_NOT_EMPTY(),default=None,widget=lambda f,v: 
> SQLFORM.widgets.text.widget(f, v, _placeholder='Write few things to 
> summarize your posing. For job or a project. ')),
>                 Field('frequency', 
> type='list:string',requires=IS_IN_SET(('Sometime','few time','All the 
> time', 'weekly'), multiple=True),widget=lambda field,  value: 
> SQLFORM.widgets.checkboxes.widget(field, value, style='divs', label=True, 
> _class='horizontal')), 
>                 Field("Budget", "integer", label='Budget', default=None),
>                 auth.signature)
>
>
>

-- 
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