Just entered the world of YII. Have been looking through it but have to rush to development as well.
I would like to know how to use System Validators to validate form fields. I have created a form using GII Form Generator but not being able to validate Email address. Do we need to use extensions for this? Have read through forums about System Validators but not being able to use it.
Can anyone tutor me on how to use System Validators?
Everything you need to know is in the rules() method of your model
public function rules()
// NOTE: you should only define rules for those attributes that
// will receive user inputs.
The above code says that when the form is submitted, the email field is required and it needs to be a valid email address.
For more information, see the rules() method in the api.
Also, take a look at the scenarios also, it will help u understand when a validation rule is applied .