下面的代码实现了 扫码后提交SN给 checkpd.htm 页面,但是我在checkpd.htm页面点击回退按钮返回到 本页面时,SN字段并没有被清空,容易产生误操作,请问如何在提交时清空本页面的SN?
Dim e As RequestEventArgs = args(0)
Dim wb As New weui
If e.Cookies.ContainsKey("username") Or e.Cookies.ContainsKey("password") Then '如果cookie里面有 username 和 password字段
wb.AddForm("","form1","CheckPd.htm") '.Attribute="" ' 由CheckPd.htm接收提交的数据
Dim dr_name As DataRow=DataTables("users_Report").SQLFind("[JobNumber]='" & e.Cookies("username") & "'") '在users_Report表中查找当前工号对应的姓名
With wb.AddInputGroup("form1","ipg1","请扫描设备标签上的二维码:" & "(当前操作员:" & dr_name("Name") & ")")
.AddInput("SN","SN","Text").Attribute="""
.AddHidenValue("test","test") '为了避免一扫描就跳转,添加的干扰代码
End With
With wb.AddButtonGroup("form1","btg1",True) '显示 待用户扫描的界面
.Add("btnOK","确定","button").Attribute="" 'button千万不能写成submit,否则就会造成数据提交两遍
.Add("btn1", "退出登录", "button","./exit.htm") '返回原页面
End With
'当扫描到没有收录的二维码时,给出不存在的提示
With wb.AddDialog("","dlg3", "错误","") '增加订单失败提示框
.AddButton("btnOK","确定")
End With
'存在重复盘点记录时,给出是否重新盘点的提示.
With wb.AddDialog("","dlg4", "重新盘点确认","您确定要对当前设备重新盘点吗?")
.AddButton("btnCancel","取消").Kind = 1
.AddButton("btnOK","继续","./CheckPd.htm?SN=" & e.Cookies("SN") )
End With
wb.InsertHTML("<script>sn.focus(); </script>") ''让焦点定位在sn输入框上
wb.AppendHTML("<script src='./ajax/libs/pdScan.js'></script>") '引入脚本文件
e.WriteString(wb.Build)
Else
wb.InsertHTML("<meta http-equiv='Refresh' c>") '如果不含username或password的cookies,那就直接跳转到登录界面
e.WriteString(wb.Build) '生成网页
End If