Hi sorry I’m a bit of a Java noob and I could really use some help. I’d like to add some very simple validation to this form. All I really want is that if you type in some text and it matches three options, say “red”, “green” or “blue”, it bypasses the confirm() and submits the form. If any text other than the three options is entered you have to OK the confirm() to submit or cancel (like the way the code below currently operates). I’ve never used validation before and it’s proving a real headache!
[CODE]<script>
function convert() {
document.execute.first.value = document.execute.first.value.replace( /s/g, “”);
var first = document.getElementsByName( “first”)[0];
var second = document.getElementsByName( “second”)[0];
second.value = “(“+ first.value +”)”;
msg = document.execute.second.value +” Correct?”
if(confirm(msg)) { location.href=second.value; }
}
</script>
<form name= “execute” onsubmit=’convert();return false;’>
<input name=’first’ type=’text’ /> <input name=’second’ type=’hidden’ />
<input type=’submit’ value=”Execute” />
</form>
I’d really appreciate any help
Thanks!