If you benefit from web2py hope you feel encouraged to pay it forward by contributing back to society in whatever form you choose!


  • 0
    reyelts  14 years ago
    Thanks loads! I skimmed through the source before posting and couldn't see the error... you have much better eyes than me. I'm using it for a birth date field and modified it so the year range is always the current year - 100 instead of the hardcoded 200 year range. In case anyone is interested, here's the mod: replace: dtval = v if v else datetime.date.today() y,m,d=str(dtval).split("-") with this: now = datetime.date.today() dtval = v if v else now.isoformat() y,m,d=dtval.split("-") and replace: year = SELECT([OPTION(i) for i in range(1900,2100)],value=int(y),_id=dt['_id']+'_year') with this: year = SELECT([OPTION(i) for i in range(now.year-99,now.year+1)],value=int(y),_id=dt['_id']+'_year') Note that I also removed the call to str() for dtval by having the default dtval be isotime() instead of the date object itself. It saves the interpreter from running str() when dtval is set to v.

Commented on:

Here is another widget that uses three selects to allow the user to pick a date.

Hosting graciously provided by:
Python Anywhere