My own workaround for this issue is to to declare it as string and regexp
,Field('actual_date', 'string', length=10
          # YYYY or YYYY-MM or YYYY-MM-DD
          ,requires=IS_EMPTY_OR(IS_MATCH('^(\d{4})$|^(\d{4})[-
/.]((0[1-9])|(1[0-2]))$|^(\d{4})[- /.]((0[1-9])|(1[0-2]))[-
/.]((0[1-9])|[12][0-9]|3[01])$',error_message='must be YYYY or YYYY-MM or
YYYY-MM-DD')))


On Friday, December 2, 2011, Anthony wrote:

> The calendar picker is handled entirely via JS on the client side. This
> code (
> http://code.google.com/p/web2py/source/browse/applications/welcome/static/js/web2py.js#32)
> in web2py_ajax.js adds the datepicker to date, datetime, and time fields.
> If you don't want it, you can edit that code or simply delete/rename
> calendar.js (or anytime.js, depending on which version of web2py you have).
>
> Anthony
>
> On Thursday, December 1, 2011 6:45:18 PM UTC-5, Rick wrote:
>>
>> Now I've a similar problem. How to make a button that shows a calendar
>> when you click on it? The reason why I want to do that kind of button
>> is that each time I try to write a date in the field the calendar pops
>> up, even though I don't need it. Here is my code again:
>>
>> dayform = SQLFORM.factory(
>>         Field('thedate', 'date', label=T(''),
>> widget=SQLFORM.widgets.date.**widget),
>>          submit_button='Some text')
>>
>> Thanks in advance for help
>>
>> On Dec 1, 10:37 pm, Rick <[email protected]> wrote:
>> > Thanks! This is the final code:
>> > dayform = SQLFORM.factory(
>> >         Field('thedate', 'date', label=T(''),
>> > widget=SQLFORM.widgets.date.**widget),
>> >          submit_button='Some text')
>> >
>> > On Dec 1, 10:12 pm, Anthony <[email protected]> wrote:
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> > > Submit buttons are not in fields, they are added as an input element
>> to an
>> > > entire form. Where is that Field definition -- in a table definition
>> or
>> > > SQLFORM.factory? Anyway, SQLFORM takes a 'submit_button' argument,
>> which is
>> > > the text for the submit button.
>> >
>> > > Anthony
>> >
>> > > On Thursday, December 1, 2011 3:57:30 PM UTC-5, Rick wrote:
>> >
>> > > > Hi,
>> > > > How to change the text on the submit button in fields? Here'sthe
>> code:
>> >
>> > > > Field('thedate', 'date', label=T(''),
>> > > > widget=SQLFORM.widgets.date.**widget))
>> >
>> > > > I tried with this, but i didn't work:
>> > > > Field('thedate', 'date', label=T(''),
>> > > > submit=INPUT(_type='submit'('**Some text')),
>> > > > widget=SQLFORM.widgets.date.**widget))
>> >
>> > > > Thanks in advance for help!
>>
>>

Reply via email to