CodeIgniter Forums
valid_email - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forum-28.html)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forum-30.html)
+--- Thread: valid_email (/thread-68554.html)



valid_email - donpwinston - 07-26-2017

If my email field is not a required field I still get an error message when the user leaves the email field empty. The valid_email rule should not return an error in this case. If it is required then the rule would be required|valid_email. valid_email is impossible to use if it is not required. I had to make my own. I think CI3 works properly?


RE: valid_email - Martin7483 - 07-26-2017

No, rules are independed and do not run based on the outcome of other rules.
An empty value is not a valid email. So it does do what it should do.


RE: valid_email - donpwinston - 04-12-2018

Then there should be a "nullable" rule to fix this problem. (I believe Laravel does this)


RE: valid_email - InsiteFX - 04-14-2018

Then Laravel is doing it wrong!

What happens if you try to send an email without an email address?

CodeIgniter is doing it the correct way.


RE: valid_email - Paradinight - 04-14-2018

(04-14-2018, 03:11 AM)InsiteFX Wrote: Then Laravel is doing it wrong!

What happens if you try to send an email without an email address?

CodeIgniter is doing it the correct way.

There is more than one way. Your reasoning is wrong.

PHP Code:
if(checkIfEmailExist) {
    
sendEmail();

...


RE: valid_email - InsiteFX - 04-14-2018

@Paradinight

I understand that, I was just pointing out that CI was not wrong.

If you give the same problem to 10 different programmers you will get 10 different results.