Model Rule Date And Type (Dateformat) Not Working

I am trying validate a field birthdate in my form but the javascript with the error message doens’t work. I have tried a ‘date’ and ‘type’ (dateFormat) rule. The column birthdate in the database is DATE and NOT NULL.

  • Appliance Turnkey

  • Apache 2.2.16

  • Tested in all browsers

  • Tested with version 1.1.12 and 1.1.13

Can you show the rules defined in your model?

You can see the respective rules in the attached file posted in my first topic. It’s a dual screen, just move to the side.

You have to set allowEmpty to false. http://www.yiiframework.com/doc/api/1.1/CDateValidator#allowEmpty-detail

Yea, the validation with PHP work (pressing the button), but with javascript (onblur) not. You know how i can solve this?

[color="#006400"]/* moved from Bug discussion */[/color]

@jacmoe: are you sure it is not a bug? I am not :)

Oh, found it: clientValidateAttribute() is not implemented in CDateValidator, there is no client validation. You have to use at least ajax validation for it. There is already an issue for that: https://github.com/yiisoft/yii/issues/887

I am positive: it’s marked as “Feature” not bug. ;)

Yep, you’re right ;)