S
S
sz92014-06-23 09:29:05
Yii
sz9, 2014-06-23 09:29:05

Output of two errors to one field?

Hello.
What is the reason for displaying two errors to the field?
For example, there is an e-mail field, in rules there is a rule for an empty field, and an invalid e-mail format.
It is possible to display two errors if there is a rule:

array('uemail','email','message'=>'не верный формат'),
array('uemail','required','message'=>'пусто'),

What is the probability of getting two errors to the same field at once.
Thank you

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
Philip, 2014-06-23
@shcherbanich

You won’t get two errors at once, the rules are checked in turn. I advise you to first put array('uemail','required'),

D
dotzero, 2014-06-27
@dotzero

You can get by with one email validator with the allowEmpty parameter

array('uemail','email','message'=>'не верный формат','allowEmpty'=>false)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question