xmatzx01
(Mathew Magante)
April 23, 2015, 2:56am
1
I make a registration form, and my problem is I don’t know how to trap the users inputted data
and my question is
how to make a input validation like this its i need to code it manually or something in yii i need to call to validate the inputted data in customize registration form??
thanks a lot in advance
SiZE
(Sizemail)
April 23, 2015, 5:20am
2
xmatzx01:
I make a registration form, and my problem is I don’t know how to trap the users inputted data
and my question is
how to make a input validation like this its i need to code it manually or something in yii i need to call to validate the inputted data in customize registration form??
thanks a lot in advance
for input validation, you need to define validation rules in your model.
See your model, there is a rules function, in which you can define rules as you need for input value.
eg. -
/**
* @return array validation rules for model attributes.
*/
public function rules(){
array('id, name, username, email', 'required'),
array('email', 'email', 'message'=>"The email isn't correct."),
array('email', 'unique', 'message' => 'Email address already exist, please enter another email address.'),
}
More help - Model rules validation
All U need is to set rules in your model class.
Check this Model.rules
xmatzx01
(Mathew Magante)
April 24, 2015, 1:27am
5
Thanks a lot for helping me hmpp… i got a problem again when I try to put required why I am getting error
please check the attachment sir =)
xmatzx01
(Mathew Magante)
April 24, 2015, 2:59am
6
xmatzx01
(Mathew Magante)
April 24, 2015, 3:24am
7
ah ok, I understand now don’ t put all rules in one line…
correct rule
array(’…some,fileds,here’,‘required’),
array(’…some,fileds,here’,‘length’,‘max’=>50),
thanks a lot ruling solve
topic close =)