troubleshooting Question

javascript replace function not working

Avatar of cwickens
cwickensFlag for United States of America asked on
JavaScript
4 Comments1 Solution951 ViewsLast Modified:
on my form (it is in an iFrame which shouldn't matter) I have the following function to make sure a user doesn't enter a comma, semi-colon or a period in a time field only a colon is allowed.  I have tested and tested with no issue at all; however within 2 days of posting the javascript I recieved a database error that someone had been able to get a period passed this.

<input name="ResolveTime" type="text" class="SearchBoldHeaders" id="ResolveTime" value="<% If Request("Calculate") = "" Then Response.Write FormatDateTime(Time, vbShortTime) Else Response.Write(RemoveValues(Trim(Request("ResolveTime")))) End If%>" size="5" maxlength="5" onChange="CheckTime();"/>

function CheckTime() {
      var f = document.form7.ResolveTime
      f.value = f.value.replace(".",":");
      f.value = f.value.replace(",",":");
      f.value = f.value.replace(";",":");
      }

isn't the code correct?  Does anyone have any ideas?
ASKER CERTIFIED SOLUTION
Saqib Khan
Senior Developer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros