| ftw.datepicker provides a date/time picker widget for your z3c.form fields using the jQuery based DateTimePicker widget from XDSoft (http://xdsoft.net/jqplugins/datetimepicker/). Usage You can apply the widget to your field with the help of plone.directives.form: from plone.directives import form
from plone.supermodel import model
from ftw.datepicker.widget import DateTimePickerWidgetFactory class MySchema(model.Schema):
    form.widget(due_date=DateTimePickerWidgetFactory)
    due_date = schema.Datetime() This renders a widget which allows to select the date and time. You can pass a custom configuration of the widget like this: from plone.directives import form
from plone.supermodel import model
from ftw.datepicker.widget import DateTimePickerWidgetFactory class MySchema(model.Schema):
    form.widget(due_date, DateTimePickerWidgetFactory, config=my_config)
    due_date = schema.Datetime() config can either be a dict or a callable which produces a dict. The value is then converted to a JSON object and passed to the template for the widget to be picked up. Example: {‘format’: ‘d.m.Y’, ‘timepicker’: False}. See http://xdsoft.net/jqplugins/datetimepicker/ for a full list of options. You could apply the widget even to a TextLine field if you need to. |