i have 2 form fields, one is primary email, the other is confirm email. how can i validate the confirm email so that it is the same as the primary email? what javascript code could i use for that? thanks
@UltimaterMay 12.2005 — #Sounds like you should sign my guestbook now! ? (see sig.) [code=html] <script type="text/javascript"> function validate(){ if(arguments[0].email1.value!=arguments[0].email2.value) {alert("Your email address don't match the confirmation email address!");return false}
if(arguments[0].email1.value.indexOf("@")==-1) {alert("Please enter your email address in this format:[email protected]");return false}
if(arguments[0].email1.value.length<4) {alert("Your email address is too short to be real!");return false}
@VladdyMay 12.2005 — #Validation of an e-mail is a waste of time and effort.
"[email protected]" is an absolutely valid e-mail but it would do you as much good as "#$%*&"
You can have a user-friendliness feature that prompts them if e-mail field data does not have proper syntax, but then save them an aggrivation of having to type it twice (most actually do Ctrl+C - Ctrl+V making the matching of the two fields once again pointless)
@UltimaterMay 12.2005 — #The best way to validate email addresses is to use a server-side program to dispatch an email to them with a link for them to click on that will confirm the email address.
Thus, when the link is clicked, that query string is sent to the PHP program and will try to match that hash with the hash of an email address awaiting to be confirmed. Then when the email is confirmed the user's profile is updated and their email address is verified otherwise it would remain un-verified.
You can even make the PHP program delete hashes from it's awaiting-email- address-to-be-verified list after a period of time -- say 1 month.
@mikewootenauthorMay 12.2005 — #ok thanks, that works, but where do i point the form to? where in the form would i point to the next page like anotherpage.html after clicking submit?
i need to point to the next page, where would i do that?
@UltimaterMay 12.2005 — #Note: It is possible to provide a phony email address and verify it by calculating the hash that would be generated and entering the link manually.
I haven't tried doing this before though, but I should give it a shot once and see if I can bypass some security, just to see how secure it is.
It's best to use hash generaters that use random numbers rather than algorithms to generate the hashes.