Welcome Guest, Not a member yet? Register   Sign In
valid_email
#1

(This post was last modified: 07-26-2017, 07:42 AM by donpwinston.)

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?
Simpler is always better
Reply
#2

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.
Reply
#3

Then there should be a "nullable" rule to fix this problem. (I believe Laravel does this)
Simpler is always better
Reply
#4

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.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#5

(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();

...
Reply
#6

@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.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply




Theme © iAndrew 2016 - Forum software by © MyBB