Gossamer Forum
Home : General : Internet Technologies :

Javascript Validation help

Quote Reply
Javascript Validation help
Heya all,

I've grabbed the piece of JS from the internet. I know nada about JS so I'm hacking this together.Wink

I want to validate a specific field (email) and simply pop a warning when someone is using a hotmail account. After they close the pop-up I want the form submission to proceed as normal.

This works fine except that nothing happens after they close the pop-up. The JS was apparently written to prevent them from continuing if the function is true. How do i need to tweak this to get the form to be submitted after they read the warning?

Code:
<HEAD>

<script language="javascript">
<!--
Names = new Array(
"hotmail")
function Check() {
//Change FORM and FIELD to the form name and field name throughout this function
namechk=document.FORM.FIELD.value.toLowerCase()
awdrgy = 0
aLeRt = 0
while (awdrgy<=Names.length-1 && aLeRt!=1) {
if (namechk==Names[awdrgy]) {
aLeRt = 1
alert("You are using a Hotmail account")
document.FORM.FIELD.value=""
}
awdrgy++
}
}
-->
</script>

</HEAD>

<BODY>

<form name="FORM">
<input name="FIELD" onblur="Check();" onblur>
<input type="button" onclick=storytest() value="Submit" class="form">
</form>

Safe swoops
Sangiro

Last edited by:

sangiro: Sep 17, 2004, 4:40 AM
Quote Reply
Re: [sangiro] Javascript Validation help In reply to
Here's what I'd do... It gives instant gratification.

<script language="javascript">
function warnHot() {
if (/hotmail/i.test(bob.email.value)) {
alert('Hey - you are using Hotmail');
}
}
</script>

<form name="bob">
<input type="text" name="email" value="" onChange="warnHot()">
</form>
Quote Reply
Re: [Watts] Javascript Validation help In reply to
Thank you! Works for me. Smile

Safe swoops
Sangiro