For the datepicker to work, you need /static/js/anytime.js and
/static/css/anytime.css, with both of those included in the document. Those
files come with the 'welcome' app, and web2py_ajax.html (which is included
in the 'welcome' layout.html) handles including them. However, if you
aren't using the current 'welcome' or web2py_ajax.html isn't included in
your layout head, then you'll have to get these files included manually.
Also, if you have multiple forms with the same date field name on a page,
they must be based on different table names, as the table name is used in
the element ID, which must be unique on the page. This can be an issue with
SQLFORM.factory forms, which all use the same default 'no_table' name for
the table -- you can change that by specifying the table_name argument to
make it unique to the form.
Anthony
On Monday, October 31, 2011 11:45:50 PM UTC-4, petrasadi wrote:
>
> From what I read, if the _class and _time attributes of a FORM both
> reference "datetime", then this should render a datetime picker in the
> view. Is this correct?
>
> My code:
> form=FORM('Date and time: ', INPUT(_name='date', _class='datetime',
> _type='datetime'), INPUT(_type='submit'))
>
> and upon execution I am expecting a datetime picker like one rendered
> by the database administrator, but not getting that.
>
> What am I doing wrong?