On Thursday, December 29, 2016 at 4:00:36 AM UTC-8, Nabil Ontour wrote:
>
> Thank you Dave, that fixed it for me, so that I can access the page again.
>
> The table is defined like that:
>
> db.define_table('income',
> Field('description','string',label='Description *'
> ,requires=IS_NOT_EMPTY()),
> Field('category','reference inc_categories',label='Category
> *',requires=IS_NOT_EMPTY()),
> Field('income_TSh','decimal(10,2)', label='Income in TSh
> *', requires=IS_NOT_EMPTY()),
> Field('calendar_date','date',label='Calendar Date *',
> requires=IS_NOT_EMPTY()),
> auth.signature
> )
>
> and is accessed via a form in controllers:
>
> form = SQLFORM(db.income).process()
>
> The calendar date is chosen via a widget, but I just checked again, it is
> also possible to enter it by hand.
>
> It is also true that some users are from Germany, where it is common to
> put the day before the month, and some users are from other countries. So
> maybe somebody has entered it by hand in the wrong order.
>
>
> How could I make sure that the date is always entered correctly?
>
Take a look at the date validator:
<URL:http://web2py.com/books/default/chapter/29/07/forms-and-validators#Date-and-time-validators>
You might also want to check the representation clause:
<URL:http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#format--Record-representation>
(I think that has come up in this forum wrt dates, from time to time.)
/dps
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.