you need to include calendar.js and web2py.js at least. Those lines in
web2py.js initialize the calendar widget on any input that has a class of
time, date or datetime.
...
var date_format = (typeof w2p_ajax_date_format != 'undefined')
?w2p_ajax_date_format
: "%Y-%m-%d";
var datetime_format = (typeof w2p_ajax_datetime_format != 'undefined')
?w2p_ajax_datetime_format
: "%Y-%m-%d %H:%M:%S";
jQuery("input.date",target).each(function() {Calendar.setup({inputField:
this, ifFormat:date_format, showsTime:false });});
jQuery("input.datetime",target).each(function() {Calendar.setup({
inputField:this, ifFormat:datetime_format, showsTime: true, timeFormat: "24"
});});
jQuery("input.time",target).each(function(){jQuery(this).timeEntry();});
...
On Saturday, September 1, 2012 7:47:04 PM UTC+2, Alec Taylor wrote:
>
> I can't seem to get the date widget to work.
>
> Using the following with crud.create still leaves me without a date
> widget, even though I've been overly explicit:
>
> db.define_table(
> 'dob',
> Field('user_id', db.auth_user, unique=True, default=auth.user_id,
> readable=False, writable=False),
> Field('DOB', 'date', requires=IS_DATE_IN_RANGE(minimum=date(1920,1,1)),
> label=T('D.O.B.'), widget=SQLFORM.widgets.date.widget),
>
> )
>
>
> How do I get this to work?
>
>
> Thanks for all suggestions,
>
>
> Alec Taylor
>
>
> FYI: I'm using a custom scaffolding layout, so might not be including the
> right JS. What JS should I be including for this?
>
>
--