Yii Framework Forum: cactiveform js validation not working? - Yii Framework Forum

Jump to content

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

cactiveform js validation not working? Rate Topic: -----

#1 User is offline   resplendent 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 60
  • Joined: 22-May 09
  • Location:Singapore

Posted 06 June 2010 - 09:42 AM

I wonder anyone has the same problem as me when using CActiveForm. Even if enableAjaxValidation is set true, the validation is still not done through ajax. So I went through the framework coding, and found that in order to get yiiactiveform registered, enableAjaxValidation must be enabled and CActiveForm::_attributes must not empty.

But CActiveForm::_attributes is a private variable, I am not allow to set. CActiveForm::_attributes is set in the later part - CActiveForm::_attributes = array_value($clientOptions['attributes']);

So how do I solve this problem?
0

#2 User is offline   james2010 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 48
  • Joined: 19-February 10

Posted 06 June 2010 - 11:39 AM

look at this . last post .

http://www.yiiframew...rm/page__st__40

if you use Gii to generate a Form.you can check the generated Form. you will see that Ajax validation is working.
0

#3 User is offline   james2010 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 48
  • Joined: 19-February 10

Posted 06 June 2010 - 11:40 AM

can you post the Code ? or send it to me . i will get i work .
0

#4 User is offline   resplendent 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 60
  • Joined: 22-May 09
  • Location:Singapore

Posted 06 June 2010 - 09:30 PM

Thanks James for your post. I read through and found the solution. All I have to do is to get $form->error(); insert and it will register yiicactiveform javascript in.

But I wonder why do I need to insert $form->error when my clientOptions['inputContainer'] is set 'span' and not the default error tag.
0

#5 User is offline   Amore 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 13-August 13

Posted 22 August 2013 - 07:32 AM

even though i added $form->error(); in my view and modified cActiveform as public $enableClientValidation=true; to make default values as enabled. but still validations are not working in my form.
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