reset password
Author Message
TonyOs1
Posts: 13
Posted 16:12 May 29, 2016 |

Hey I was hoping if someone could help me out or give me some hints and tips.
For email validation, I was trying to set a variable equal to document.PizzaForm.email.value

but:

1) I'm not sure if I'm supposed to be doing that, or if it'll work, and

2) How does/will it know if the email is the correct "type", as in, give an alert if the email is incorrect?

Thank you for any help in advance.

cgome106
Posts: 19
Posted 16:31 May 29, 2016 |

Your variable choice is correct, so dont worry about that.

On the form itself, if you set the input type to "email" the code will automatically detect if i is a valid email.

Hope this helps

epascua
Posts: 47
Posted 16:34 May 29, 2016 |

CGome, are you talking about <input type = "email" name = "customerEmail" placeholder = "UserName@Example.com">? I tried doing that for the input type, but it isn't really validating it. lol Am I doing something wrong?

cgome106
Posts: 19
Posted 16:38 May 29, 2016 |

EPascua, try adding a "/" after your placeholder. You did not close your input, therefore the code cannot properly find the value. Try that.

TonyOs1
Posts: 13
Posted 17:08 May 29, 2016 |

Hey thank you so much, I appreciate your help. I don't know if you can help me out on one last thing, please.

For the "Order evaluation", I was trying to use if/else if loops to check each thing individually. I had variables equal to "" (just a space, basically), and if the result is true, the result would be "You did not enter ___". However, this clearly doesn't work well with the email validation, because if you simply entered a word (not with "@email.com"), it still results as "true" for an email, which is a problem since it's not really the email type. I changed the input type to email, as well. Any suggestions?

Last edited by TonyOs1 at 17:10 May 29, 2016.
TonyOs1
Posts: 13
Posted 17:28 May 29, 2016 |

I looked up some stuff online, and I know it says you can use "required", I'm just not sure if the "the reason will be in an alert" has to be for every thing (name, address, email, etc.)