Yii Framework Forum: $This->Adderror Not Highlighting The Text Box - Yii Framework Forum

Jump to content

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

$This->Adderror Not Highlighting The Text Box but default required validator makes it red. Rate Topic: -----

#1 User is offline   Azy 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 156
  • Joined: 16-May 12

Posted 06 December 2012 - 05:31 AM

Hi Yii members,

I have used the below code to make a textbox Required based on a scenario.

array('method', 'validateRequiredFields'),

Quote

public function validateRequiredFields($attr, $params) { ....

if (empty($this->ecard)) {
$this->addError($this->ecard, 'e-card: cannot be blank.');
$errors = true;
}
.... }



Posted Image

The problem here is, it is showing me the error message as you can see in the attached screenshot. but unfortunately it isn't highliting the text box in red color which its doing if i use the default validator. like below,

array('ecard,', 'required'),

can somebody tel me whay its happening pls?

Thanks.
0

#2 User is offline   Azy 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 156
  • Joined: 16-May 12

Posted 06 December 2012 - 05:46 AM

bump.
0

#3 User is offline   Azy 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 156
  • Joined: 16-May 12

Posted 06 December 2012 - 05:51 AM

Problem Resolved.

Its my fault, i was using $this->addError($this->ecard, 'e-card: cannot be blank.');
where it should be, 

$this->addError('ecard', 'e-card: cannot be blank.');


:)
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