如果某个页面没有使用e.WriteString返回内容,就会出现【foxtable web server has started(error 404).】这个错误提示
Dim wb As New weui
Select Case e.Path
Case "records.htm"
If e.PostValues.Count = 0 Then
wb.AddForm("", "form1", "addnew.htm")
With wb.AddInputGroup("form1", "ipg1", "员工档案")
.AddInput("入职日期", "入职日期", "date").Value = Format(Date.Today, "yyyy-MM-dd")
.AddInput("姓名", "姓名", " ")
.AddInput("身份证号", "身份证号", "text")
.AddSelect("部门", "部门", "成型|包装|行政|计划|财务")
.AddTextArea("家庭地址", 5).Placeholder = "家庭地址"
End With
With wb.AddButtonGroup("form1", "btg1", True)
.Add("btn1", "确定", "submit")
End With
wb.AppendHTML("<script src='./lib/brands.js'></script>") '引入脚本文件
e.WriteString(wb.Build)
Else
Dim nms() As String = {"入职日期", "姓名", "身份证号", "部门", "家庭地址"} '不能为空的列名数组
For Each nm As String In nms
If e.PostValues.ContainsKey(nm) = False Then '生成错误提示页
With wb.AddMsgPage("", "msgpage", "增加失败", nm & "列不能为空!")
.icon = "Warn" '改变图标
.AddButton("btn1", "返回").Attribute = ""
End With
e.WriteString(wb.Build)
Return '必须返回
End If
Next
nms = New String() {"入职日期", "姓名", "身份证号", "部门", "家庭地址"} '重新定义了nms数组,增加了两列.
Dim dr As DataRow = DataTables("计件工资明细").AddNew()
For Each nm As String In nms
If e.PostValues.ContainsKey(nm) Then
dr(nm) = e.PostValues(nm)
End If
Next
dr.save()
With wb.AddMsgPage("", "msgpage", "增加成功", "好好学习,天天向上") '生成成功提示页
.AddButton("btn1", "继续增加", "addnew.htm")
End With
e.WriteString(wb.Build)
End If
End Select
Case "records.htm"
If e.PostValues.Count = 0 Then
wb.AddForm("", "form1", "records.htm")