Yii Framework Forum: Multiple Validation - Yii Framework Forum

Jump to content

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

Multiple Validation Rate Topic: -----

#1 User is offline   dobelman 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 10
  • Joined: 20-June 12

Posted 23 October 2012 - 12:54 PM

Hi,
i need little help.
I have a few fields and all of them are required.
I wrote validator:

array('field1, field2, field3,..., 'required', 'message'=>'this field is required').

but In summary error Ive got:


This field is required
This field is required
This field is required
This field is required...

is there any trick that i will have:

The field1 is required
The field2 is required
The field3 is required
The field4 is required...

without creating 4 or more arrays(validators)??
I want to keep my code as simple as possible :)
0

#2 User is offline   Iran 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 14
  • Joined: 27-September 12

Posted 26 October 2012 - 07:59 AM

I think you can use placeholder {attribute} in your message property

read this =>
http://www.yiiframew...#message-detail

and this =>
http://www.yiiframew...alidation-rule/

PS: I didn't test it
0

#3 User is offline   dobelman 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 10
  • Joined: 20-June 12

Posted 28 October 2012 - 01:46 PM

Thanks, it works:)

array('username,password', 'required', 'message'=>'Please fill {attribute}'),

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