I think the problem is that there are two places date is manipulated: serverside (and you have taken care of it) and clientside (by the popup calendar).
a) The quick fix is to edit the views/web2py_ajax.html and set the date format to be the same DD-MM-YYYY. b) The best way is to let the locale determine the format for different users: IS_DATE(str(T('%Y-%m-%d'))), and use the translation page to translate the date format. Massimo On Apr 12, 10:42 am, jmverm...@xs4all.nl wrote: > Massimo, > > Happy Easter to you too. > > Your reply solved my problem, however, I encountered another problem. > The function of this use case reads like: > > def byplace(): > form=form_factory(SQLField('plaats',requires=IS_NOT_EMPTY(),\ > widget=lambda self, value:INPUT > (_id='eventbyplace',_name='plaats',_class='ac_input',_type='text',requires=self.requires)), > SQLField('datum',type='date',requires=[IS_DATE('%d-%m- > %Y'),IS_NOT_EMPTY()]),\ > SQLField('dagen',requires=IS_IN_SET([7,14,28,56],labels=['1 > week','2 weken','4 weken','8 weken']))) > events=[] > if form.accepts(request.vars,session): > response.flash='Geen match plaats datum' > fromdate=request.vars.datum > todate=IS_DATE()(fromdate)[0]+datetime.timedelta(days=int > (request.vars.dagen)) > events=db((db.event.plaats==request.vars.plaats)& > (db.event.datum>=fromdate)&\ > (db.event.datum<=todate)&(db.event.doelgroep=='Consumer')& > (db.event.scope=='Extern'))\ > .select > (db.event.id,db.event.event,db.event.datum,db.event.locatie,\ > db.event.eventtype,orderby=db.event.datum) > elif form.errors: > response.flash='form has errors' > else: > response.flash='please fill the form' > return dict(form=form,events=events) > > When I expose it, and click the submit button, the form doesn't pass > validation: must be YYYY-MM-DD the validator reports. I thought the > following line of code would solve this problem: > > SQLField('datum',type='date',requires=[IS_DATE('%d-%m-%Y'),IS_NOT_EMPTY > ()]) > > but it doesn't. > > Furthermore I expect a problem with the following lines of code: > > fromdate=request.vars.datum > todate=IS_DATE()(fromdate)[0]+datetime.timedelta(days=int > (request.vars.dagen)) > > Here todate should be calculated as: fromdate + days = todate > It worked when I used the YYYY-MM-DD format, however, now that I > changed the format to DD-MM-YYYY I expect it to break. > > Kind regards, > > Annet. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---