/    Sign up×
Community /Pin to ProfileBookmark

Validation not working in IE 4.0

I have the following function which runs on a change event of a text box:

[code]
function ValidateLocator()
{
if(/d{1}[A-z]|[A-z]{1}d/.test(frmGeneral.txtLocator.value))
{
frmGeneral.submit();
}else{
alert(“You entered an invalid Locator”);
document.frmGeneral.txtLocator.focus();
return(false);
}

[/code]

It appears to work fine on ie7; however, in ie4 it simply tabs to the other textbox on the screen and doesn’t do anything. Here is the entire page with code. Any ideas?

[code]
<!– #include file=”dbOS.asp” –>
<%
dim ssql
dim intPartID, strLocator, dteDateTime, strSubmission

intPartID = trim(request.form(“txtPartID”))
strLocator = trim(request.form(“txtLocator”))
dteDateTime = now()

if len(intPartID) > 0 then
ssql = “INSERT FullWarehouseScan (PartID, Locator, DateStamp) VALUES (“&intPartID&”, ‘”&strLocator&”‘, ‘”&dteDateTime&”‘)”
‘response.write(ssql)
dbc.execute(ssql)
strSubmission = “yes”
end if
%>

<html>

<head>
<title>Full Warehouse Scan</title>
</head>

<body OnLoad=”SetFocus()”>
<h2><font face=”verdana”>Full Warehouse Scan</h2>
<form id=”frmGeneral” name=”frmGeneral” action=”FullWarehouseScan.asp” method=”post”>
<table border=”0″>
<tr>
<td><font face=”verdana” size=”1″>Part ID</font></td>
<td><input type=”text” id=”txtPartID” name=”txtPartID” size=”20″ onChange=”ValidatePartID()” style=”font-family: Verdana; font-size: 8pt”></td>
</tr>
<td><font face=”verdana” size=”1″>Locator</font></td>
<td><input type=”text” id=”txtLocator” name=”txtLocator” size=”20″ onChange=”ValidateLocator()” style=”font-family: Verdana; font-size: 8pt”></td>
</tr>
</table>
</form>
<%
if strSubmission = “yes” then
response.write(“<font face=Verdana size=2><b>Thank you for your submission</b></font>”)
end if
%>

</body>
</html>

<Script Language=”JavaScript”>
<!–
function SetFocus()
{
document.frmGeneral.txtPartID.focus();
}
function ValidatePartID()
{
if(isNaN(frmGeneral.txtPartID.value))
{
alert(“You must enter a numeric value for a Part ID”);
document.frmGeneral.txtPartID.focus();
return(false);
}
}
function ValidateLocator()
{
if(/d{1}[A-z]|[A-z]{1}d/.test(frmGeneral.txtLocator.value))
{
frmGeneral.submit();
}else{
alert(“You entered an invalid Locator”);
document.frmGeneral.txtLocator.focus();
return(false);
}
}
//–>
</Script>
[/code]

to post a comment
JavaScript

5 Comments(s)

Copy linkTweet thisAlerts:
@mrhooJan 16.2007 — IE4 can run with a version of jscript that doesn't support regular expressions.
Copy linkTweet thisAlerts:
@dzirkelbauthorJan 23.2007 — According to that page, it shows that it won't work in IE4.0.

Anyone have any ideas on what I can do to have this expression work in IE4.0? I just need it to validate that one letter and one number have been entered into the system, and then alert if it hasn't.
Copy linkTweet thisAlerts:
@dzirkelbauthorJan 23.2007 — I have decided to do server side validation and it does the job, thanks!
Copy linkTweet thisAlerts:
@A1ien51Jan 23.2007 — Who in the world runs IE4? wowzers...

Eric
×

Success!

Help @dzirkelb 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 6.1,
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: @meenaratha,
tipped: article
amount: 1000 SATS,

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

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...