Calendar widget in a custom form?

471 views
Skip to first unread message

Keith Planer

unread,
Dec 30, 2013, 3:48:06 AM12/30/13
to web...@googlegroups.com
After adding some input validation I've realized that the calendar widget is not popping up. Is there anything I need to add to the controller or elsewhere?

form=FORM(TABLE(...TR("Admission Date: ",INPUT(_name='adm_date',widget=SQLFORM.widgets.date.widget,requires=IS_DATE()))...


Alan Etkin

unread,
Dec 30, 2013, 4:50:03 AM12/30/13
to web...@googlegroups.com
After adding some input validation I've realized that the calendar widget is not popping up. Is there anything I need to add to the controller or elsewhere?

I suspect there's no widget option for the INPUT objects, unless it was added and was not updated in examples:

http://www.web2py.com/examples/static/epydoc/gluon.html.INPUT-class.html

However, for a similar effect, you can use a customized SQLFORM object

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

Paolo Caruccio

unread,
Dec 30, 2013, 9:33:34 AM12/30/13
to web...@googlegroups.com
Please try to add to the INPUT the class "date":

form=FORM(TABLE(...TR("Admission Date: ",INPUT(_class='date',_name='adm_date',widget=SQLFORM.widgets.date.widget,requires=IS_DATE()))...

Keith Planer

unread,
Dec 30, 2013, 10:16:47 AM12/30/13
to web...@googlegroups.com
That fixed it, Paolo, thanks!


--
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 a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/yx1h4TMnXBU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Keith Planer

unread,
Dec 30, 2013, 12:31:36 PM12/30/13
to web...@googlegroups.com
One other small problem, the field doesn't allow for nothing to be entered now. How do I make it optional?

Keith Planer

unread,
Dec 30, 2013, 12:36:14 PM12/30/13
to web...@googlegroups.com
Nevermind, found it.
requires=IS_EMPTY_OR(IS_DATE())
Reply all
Reply to author
Forward
0 new messages