I have a situation using VBScript where I read a table of valid serial numbers and if the serial number cannot be found, blank out the serial number field, display an error message, and reload the page. Listed below is some of the code which would be issued after the valid serial number table is read. ( The error message display is left off since that code is working.)
Serial # field:
Expand|Select|Wrap|Line Numbers
- <input type="text" name="SerialNum" id="SerialNum" MaxLength="11" value="<%=strSerialNum%>">
Expand|Select|Wrap|Line Numbers
- <%
- If rec.EOF Then
- (Display Error Message Code here.)
- strSerialNum = ""
- %>
- <script>
- window.location.reload();
- </script>
- <%
- End If
- %>
The problem is that blanking out the variable strSerialnum is not blanking the SerialNum field and after the reload is issued (after a bad serial number is entered), the code at the top of the program:
strSerialNum = Request.Form("SerialNum")
reloads the bad serial number.
I tried using the following before the reload:
<script type="text/javascript">
document.frmPPDM.SerialNum.value = "";
</script>
but got an error indicating a null object. Does anyone have any ideas, how to blank out the SerialNum field before doing the reload of the page?