How to create a yahoo.ie email address?

How do I create a text field that requires people to confirm their email address?

  • I have seen this on websites I have used in the past (it seems to be used mostly for passwords, when they ask you to enter your password twice, and if they don't match, it won't let you submit the form). So how can I do the same thing for an email address? This is the code I have so far, I have already created two fields (Email Address) and (Confirm Email Address). <span id="sprytextfield1">Email Address <input type="text" name="text1" id="text1" /> <span class="textfieldRequiredMsg">Please enter an email address.</span></span><span id="sprytextfield4">Confirm Email Address <input type="text" name="text4" id="text4" /> <span class="textfieldRequiredMsg">A value is required. What code do I need to make the form only submit when both email addresses match? Thank you for any help.

  • Answer:

    The whole process of password or mail would bi similar. You have a form which onsubmit calls a Javascript function with return value to validate your form. If the form is valid (in this case both emails match) the function will return true and form submit, if not it won't do anything. <form action="example.php" onsubmit="return validate_form()"> <input type="text" id="mail1" /> <input type="text" id="mail2" /> <!-- rest of your elements --> </form> and the Javascript part: <script type="text/javascript"> function validate_form() { var str1 = document.getElementById("mail1").value; //here you can check whether str1 is a valid email var str2 = document.getElementById("mail2").value; if(str1 != "" && str1 == str2) return true; else return false //and here you can create warning so the user knows what's wrong that form won't submit } </script>

Daniel Abbott at Yahoo! Answers Visit the source

Was this solution helpful to you?

Other answers

You would need a Javascript code to read the individual key inputs of the second string and compare it to the first, maybe hiding the submit button until they match. Far better to allow subkit, passing both entries as post variables, with from cal to PHP_SELF and use an if() statement to compare them, then show itself again with both entries filled in if they do not match This way you can also verify that the entries are in legitimate email address format rather than risking a script attack from a hacker.

Colinc

you could google form validation, there's lots of free validation scripts and tutorials out there, but since it looks like you're already using validation with Spry then you will need this.. http://labs.adobe.com/technologies/spry/articles/confirm_overview/index.html

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.