【发布时间】:2017-03-15 13:10:10
【问题描述】:
我有一个应用程序,用户扫描条形码并提交表单。麻烦的是,扫描仪非常敏感,有时会进行两次扫描,因此要么不是 XXX 预期的值,而是 XXXXXX 然后表单提交,或者表单快速连续提交两次。我想以某种方式添加一些暂停条件以防止敏感的双重扫描。有什么想法吗?
当前代码
<script>
function validateForm(form) { //This is the name of the function
if (form.wonumber.value == "OP") { //This checks to make sure the field is not empty
alert("Cant Submit."); //Informs user of empty field
form.wonumber.value = ""
return false; //This prevents the form from being submitted
}
return true
}
</SCRIPT>
<form action="outer.asp" method="post" name="form100" id="form100" onSubmit="return validateForm(this)">
<div align="center">
<span class="style1 style4 style8">
Scan Parts into Outer <%=request.querystring("id")%>;</span>
<p class="style1 style2">
<input name="wonumber" type="text" id="wonumber" style="height:80px;font-size:50pt;" onChange="return validateForm(this)" size="7">
</p>
<p class="style1 style10"><%=description1%> <span class="style1 style2 style10">
</form>
【问题讨论】:
-
我不认为您提供的代码 sn-p 说明了整个故事。你会编辑你的原始帖子并插入整个代码吗?
-
更新了原始帖子以包含整个表单代码。
-
如果您从阅读器获得的字符数超过最大数量,是否可以简单地清除表单?