Yii Framework Forum: Model Rule Date And Type (Dateformat) Not Working - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Model Rule Date And Type (Dateformat) Not Working Rate Topic: -----

#1 User is offline   KillCloud 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 16
  • Joined: 02-November 12
  • Location:São Paulo, Brazil

Posted 14 January 2013 - 01:17 PM

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

Attached File(s)

  • Attached File  1111.png (426.97K)
    Number of downloads: 33

0

#2 User is offline   CeBe 

  • Advanced Member
  • Yii
  • Group: Yii Dev Team
  • Posts: 532
  • Joined: 16-July 10
  • Location:Berlin. Germany

Posted 14 January 2013 - 02:58 PM

Can you show the rules defined in your model?
0

#3 User is offline   KillCloud 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 16
  • Joined: 02-November 12
  • Location:São Paulo, Brazil

Posted 16 January 2013 - 10:40 AM

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.
0

#4 User is offline   CeBe 

  • Advanced Member
  • Yii
  • Group: Yii Dev Team
  • Posts: 532
  • Joined: 16-July 10
  • Location:Berlin. Germany

Posted 16 January 2013 - 03:39 PM

You have to set `allowEmpty` to false. http://www.yiiframew...lowEmpty-detail
0

#5 User is offline   KillCloud 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 16
  • Joined: 02-November 12
  • Location:São Paulo, Brazil

Posted 17 January 2013 - 01:39 PM

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

#6 User is offline   jacmoe 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 2,601
  • Joined: 10-October 10
  • Location:Denmark

Posted 17 January 2013 - 01:46 PM

/* moved from Bug discussion */
"Less noise - more signal"
0

#7 User is offline   CeBe 

  • Advanced Member
  • Yii
  • Group: Yii Dev Team
  • Posts: 532
  • Joined: 16-July 10
  • Location:Berlin. Germany

Posted 17 January 2013 - 02:29 PM

@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/y.../yii/issues/887
0

#8 User is offline   jacmoe 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 2,601
  • Joined: 10-October 10
  • Location:Denmark

Posted 17 January 2013 - 02:48 PM

I am positive: it's marked as "Feature" not bug. ;)
"Less noise - more signal"
0

#9 User is offline   CeBe 

  • Advanced Member
  • Yii
  • Group: Yii Dev Team
  • Posts: 532
  • Joined: 16-July 10
  • Location:Berlin. Germany

Posted 17 January 2013 - 03:16 PM

Yep, you're right ;)
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users