How to validate Email in yii
Yii is a great framework for form validation,today i am going to show you how to validate the email field in the form before submitting.Its very simple just follow the below example
if you created a user model with email as one attribute
then in the rules function add the following code
thats it
also look at the code i have added a checkMX=true(this is used for checking that domain exists),you could ignore it if you want
if you created a user model with email as one attribute
then in the rules function add the following code
public function rules() { return array( ... array('email', 'email','checkMX'=>true), .. ); }
thats it
also look at the code i have added a checkMX=true(this is used for checking that domain exists),you could ignore it if you want
thanks. i have spent over 2 hours on the internet looking for this information.
ReplyDeleteThank You
me 1/2 hr
ReplyDeleteThank you for the valuable info. It works great, although I'd love to know how the checkMX works ? Does it ping the domain, or...?
ReplyDeleteThank you. you can save my time
ReplyDeletethe checkmx dosent work for me .. it dose not check the domaim .. pls help
ReplyDeleteHow to override other unique domains like blabla.me ?
ReplyDeleteTHANKS.....
ReplyDelete