I’m new to Yii framework. Now in my form I have two fields FirstName and LastName.
I want to validate such that either of the two is filled. i.e not both should be empty.
Suppose the user leaves both the fields empty it should not allow submit. The user should atleast enter any of these fields.
Rules
public function rules()
{
return array(
array('Firstname,Lastname, email, subject, body', 'required'),
array('email', 'email'),
array('verifyCode', 'captcha', 'allowEmpty'=>!CCaptcha::checkRequirements()),
);
}
How can I do this?