本想在点击退出回到主页,测试发现在点击退出时,提示月份不能为空,说明提交了,哪里写错了???
'劳保登记
Dim e As RequestEventArgs = args(0)
Dim wb As New weui
Select Case e.Path
Case "addlaobao.htm" '添加页
wb.Title="劳保领取"
wb.AddForm("","form1","laobaohandle.htm") '指定接收表单数据的的页面为handle.htm
With wb.AddInputGroup("form1","ipg1","新增领用")
.AddInput("姓名","姓名:","text").Value=e.Cookies("uname")
.AddSelect("名称","名称:","手套|雨衣|水鞋|安全帽")
.AddSelect("月份","月份:","|1月|2月|3月|4月|5月|6月|7月|8月|9月|10月|11月|12月")
.AddInput("数量","数量:","number")
.AddSelect("单位","单位:","双|件|顶")
With .AddInput("日期","日期","datetime-local")
.Value = Format(Date.Now,"yyyy-MM-ddTHH:mm") '留意一下这个格式,日期和时间之间用字母T隔开
.Readonly = True
End With
.AddInput("领取","领取:","text").Value=e.Cookies("uname")
.AddSelect("审批人","审批人:","向**|李**|黄**|周**")
End With
With wb.AddButtonGroup("form1","btg1",True)
.Add("btn1", "提交", "submit")
.Add("btnexit","退出").Attribute="on click='location=""index.htm""'"
End With
e.WriteString(wb.Build)
Case "laobaohandle.htm" '提交页
wb.Title="提示"
Dim nms() As String = {"姓名","名称","月份","数量","单位","日期","领取","审批人"}
Dim bts() As String={"姓名","名称","月份","数量","日期","领取"} '必填项目
For Each bt As String In bts
If e.PostValues.ContainsKey(bt) = False Then '生成错误提示页
With wb.AddMsgPage("","msgpage","增加失败", bt & "列不能为空!")
.icon = "Warn" '改变图标
.AddButton("btn1","返回").Attribute = "on click='location=""index.htm""'"
End With
e.WriteString(wb.Build)
Return False '必须返回
End If
Next
......
......
With wb.AddMsgPage("","msgpage","增加成功", "") '生成成功提示页
.AddButton("btn1","继续增加","addlaobao.htm")
.AddButton("btn2","查看记录","laobaolist.htm")
.AddButton("btn3","退出","index.htm")
End With '返回增加成功消息
e.WriteString(wb.Build) '生成网页
End Select
[此贴子已经被作者于2020/11/3 16:50:43编辑过]