Page is a not externally linkable
- Code, Content, and Presentation
-- JavaScript and AJAX
---- forcing a specific mandatory text in text field


MichaelBluejay - 11:25 pm on Sep 29, 2012 (gmt 0)


There's a lot of code. Most people don't want to wade through all if it. I certainly don't. When you need help, post the absolute *minimum* code you need in order to show your problem.

If I were trying to ensure that certain text was typed with Javascript, I'd do it like this:

<script type=text/javascript> 
function validate() {
if (document.getElementById('myTextField').value != "I accept the terms") {
alert("Please type 'I accept the terms' into the text box");
return false;
}
}
</script>

<form onsubmit="return validate()" action=post.php>
<input id=myTextField>
<input type=submit value=Submit>
</form>


Thread source:: http://www.webmasterworld.com/javascript/4498859.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com