I use to validate date :

data = IS_NULL_OR(IS_DATE(format=T('%d/%m/%Y')))
def make_data(field):
    if field != None:
        return field.strftime("%d/%m/%Y")

and in the Field

    Field('data_cadastro', 'date',default=request.now,label='Data de
Registro',requires=data,represent= lambda field: make_data(field)),

2011/1/17 tomt <[email protected]>

> Hi,
>
> I have learned to use SQLFORM to generate forms.  The validation
> defined in the db model works as expected, but there are times when I
> want to write a controller that uses a different validation than what
> is defined in the model.  (Specifically, I want to force a different
> date validation)
>
> From what I've read in the manual, and in web2py-users, I can  define
> the form manually using FORM and specify the validation on each field,
> but I was hoping there was a way I could do this with SQLFORM.
>
> I'd appreciate any recommendations and/or examples.
>
> Thanks, - Tom
>



-- 
Atenciosamente


Alexandre Andrade
Hipercenter.com Classificados Gratuitos e Inteligentes

Reply via email to