/    Sign up×
Community /Pin to ProfileBookmark

submit button not firing in Firefox

I have a simple script that works in I.E., but won’t fire in Firefox.

<script language=”JavaScript”>
function ValwrlContact(){
var filter = /^([a-zA-Z0-9_.])+@(([a-zA-Z0-9])+.)+([a-zA-Z0-9]{2,4})+$/;

X=wrl_tellusform;
if (X.lname.value.replace(/^s*|s*$/g,””)==””)
{
alert(“Enter last name “);
X.lname.focus();
return false;
}

else if (X.fname.value.replace(/^s*|s*$/g,””)==””)
{
alert(“Enter first name “);
X.fname.focus();
return false;
}
else if (X.repid.value.replace(/^s*|s*$/g,””)==””)
{
alert(“Enter the repid “);
X.repid.focus();
return false;
}
else if ( (X.phone1.value.replace(/^s*|s*$/g,””)==””) || (X.phone2.value.replace(/^s*|s*$/g,””)==””)|| (X.phone3.value.replace(/^s*|s*$/g,””)==””) )
{

alert(“Enter Phone number “);
X.phone1.focus();
return false;
}

else if (isNaN(X.phone1.value)||isNaN(X.phone2.value)||isNaN(X.phone3.value)||isNaN(X.phone4.value))
{
alert(“Enter VALID Phone number “);
X.phone1.focus();
return false;

}
else if (X.wrlemail.value.replace(/^s*|s*$/g,””)==”” || (!(filter.test(X.wrlemail.value.replace(/^s*|s*$/g,””))) ))
{

alert(“Enter Valid email”);
X.wrlemail.focus();
return false;
}
else if (X.comments.value==””)
{
alert(“Enter a comment “);
X.comments.focus();
return false;
}

else {
document.wrl_tellusform.submit();
return true;
}

}

</script>

<h3>Tell us what you think!</h3>
<form name =”wrl_tellusform” action=”<portlet:actionURL/>” method =”Post” class=”forms”>
<table class=”border_off”>
<caption><span class=”required”>*</span> = Required Fields</caption>
<tr>
<th><span class=”required”>*
</span>First Name:</th>
<td><input name=”fname” type=”text” style=”width: 100px;” /></td>
</tr>
<tr>
<th><span class=”required”>*</span>Last Name:</th>
<td><input name=”lname” type=”text” style=”width: 100px;” /></td>
</tr>
<tr>
<th><span class=”required”>*
</span>Rep ID:</th>
<td><input name=”repid” type=”text” style=”width: 100px;” /></td>
</tr>
<tr>
<th><span class=”required”>*</span>Phone:</th>
<td>(<input name=”phone1″ type=”text” style=”width: 50px;” size=”3″ maxlength=”3″ />)
<input name=”phone2″ type=”text” style=”width: 50px;” size=”3″ maxlength=”3″ />-
<input name=”phone3″ type=”text” style=”width: 50px;” size=”4″ maxlength=”4″ />
ext.<input name=”phone4″ type=”text” style=”width: 50px;” size=”4″ maxlength=”4″ />
</td>
</tr>

</tr>
<tr>
<th><span class=”required”>*</span>Email:</th>
<td><input name=”wrlemail” type=”text” style=”width: 100px;” /></td>
</tr>
<tr>
<th><span class=”required”>*</span>Comments:</th>
<td><textarea name=”comments” cols=”30″ rows=”10″ style=”width: 90%;”></textarea>
</td>
</tr>
<tr>
<td></td>

<!–
<td> <input type=”hidden” name=”webforms_action” value=”wrl_TellUs_send” /></td>
<td> <input type=”Submit” value=”wrl_TellUs_send” /></td>
–>
<td> <input type=”hidden” name=”webforms_action” value=”wrl_TellUs_send” />
<input type=”button” class=”submitButton” onClick=”return ValwrlContact()” />
</td>

</tr>

</table>
</form>

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@Declan1991Nov 11.2008 — I'm not certain, but I'd say <i>
</i>X=wrl_tellusform;
is the problem. Change that toX=document.forms.wrl_tellusform;orX = document.getElementsByName("wrl_tellusform")[0];And while I'm at it, use

<script type="text/javascript"> instead of the language attribute.
Copy linkTweet thisAlerts:
@JRyeauthorNov 11.2008 — Thanks, I did notice that after I posted and used x=document.wrl_tellusform; and everything worked. Thanks for your suggestion and good eye.
×

Success!

Help @JRye spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.7,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...