this doesn't work: form=FORM(TABLE( TR(TD('Data 1:'),TD(INPUT (_class="date",_type="text",_name="data1",requires=IS_DATE('%d/%m/ %Y',error_message='date format: gg/mm/aaaa')))), TR(TD('Data 2:'),TD(INPUT (_class="date",_type="text",_name="data2",requires=IS_DATE('%d/%m/ %Y',error_message='date format: gg/mm/aaaa'))))))
it pops up a message saying: "Calendar.setup: Nothing to setup (no fields found). Please check your code" why? Paolo On 23 Nov, 18:16, mdipierro <mdipie...@cs.depaul.edu> wrote: > 1) class="date" will do what you ask, same for 'time' and 'datetime'. > > 2) db.event.vandatum.requires=IS_DATE(T("%Y-%m-%d')) > > then use the languages tab to create an en.py translation file (or en- > en.py) and translate "%Y-%m-%d" into "%d/%m/%Y" > > 3) totdatum==vandatum + dagen should be > > totdatum=IS_DATE()(vandatum)[0] + datetime.timedelta(days=int(dagen)) > > IS_DATE()(vandatum)[0] uses the validator to parse the string into a > date object. > > Massimo > > On Nov 23, 10:27 am,annet<jmverm...@planet.nl> wrote: > > > I am working on an event list, which is based on the following model: > > > db.define_table('event', > > SQLField('bedrijf', db.bedrijf, notnull=True), > > SQLField('event', length=50, notnull=True), > > SQLField('vandatum', type='date', notnull=True,), > > SQLField('totdatum', type='date', notnull=True), > > SQLField('duur', length=10, notnull=True), > > SQLField('plaatsnaam', length=40, notnull=True), > > SQLField('locatie', length=50), > > SQLField('omschrijving', type='text'), > > SQLField('sleutelwoord', db.sleutelwoord, notnull=True, > > ondelete='RESTRICT'), > > SQLField('doelgroep', db.doelgroep, notnull=True, > > ondelete='RESTRICT'), > > SQLField('scope', db.scope, notnull=True, ondelete='RESTRICT'), > > migrate='event.table') > > > In the view, I have got the following form: > > > <form> > > <p> > > Type een plaatsnaam:<br /> > > <input type="text" name="plaatsnaam" value="" /><br /> > > Selecteer een 'van' datum: > > <input type="text" name="vandatum" value="" /><br /> > > Selecteer een aantal weken: > > <select name="dagen"> > > <option value="14" selected="selected">2 weken</option> > > <option value="28">4 weken</option> > > <option value="56">8 weken</option> > > </select> > > <input type="submit" /> > > </p> > > </form> > > > My first question is: how do I get this field: > > > <input type="text" name="vandatum" value="" /> > > > to be of type date, so that the web2py_ajax code displays a calendar > > when the user enter this field. > > > My second question is: when I pick a date it is formatted like this: > > yyyy-mm-dd, whereas I would like it to be formatted this way: dd-mm- > > yyyy. Since this format applies to all dates in my application, I hope > > there is a way to set this format in one place. > > > Furthermore I got the following controller: > > > def byplace(): > > vandatum==request.vars.vandatum > > dagen==request.vars.dagen > > totdatum==vandatum + dagen > > events=db((db.event.plaatsnaam==request.vars.plaatsnaam)&\ > > (db.event.vandatum>=vandatum)&(db.event.totdatum<=totdatum)&\ > > (db.event.doelgroep==1)&(db.event.scope==1))\ > > .select(db.event.id,db.event.event,db.event.vandatum,db.event.duur, > > \ > > db.event.locatie,orderby=db.event.vandatum) > > return dict(events=events) > > > My third question is: how do I code the following line > > > totdatum==vandatum + dagen > > > where vandatum is the start date of the search, dagen is the number of > > days a visitor wants to add to the start date to get the end date of > > the search. > > > I am looking forward to your answers to these questions. > > > Best 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 -~----------~----~----~----~------~----~------~--~---