MsgPage或Dialog具体的错误信息要返回并继续执行后面的代码呢?目前就错误和确定这样一个弹窗JS文件如下:
function myfunction(){
var result = submitAjaxForm('form1','',false);
if (result =='OK') {show('dlg1')}
else {showDialog('dlg2','错误',result)}
}
Dialog要放到上一个页面,也就是form1这个绑定所在的页面
然后这个函数里不要使用MsgPage或Dialog,直接返回错误文字即可,比如
Dim e As RequestEventArgs = args(0)
Dim wb As New weui
Dim nms() As String = {"姓名", "订单日期", "订单时间", "省份", "城市", "市", "地铁线", "地铁站", "出发确认", "本人介绍", "联系方式", "开房", "客户网名", "客服网名", "单价", "单位" , "收款方式", "交待事项" } '不能为空的列名数组
For Each nm As String In nms
If e.PostValues.ContainsKey(nm) = False Then '生成错误提示页
e.WriteString("增加失败", nm & "列不能为空!")
Return"" '必须返回
End If
Next
If e.PostValues.ContainsKey("客户电话") = False And e.PostValues.ContainsKey("客户微信") = False And e.PostValues.ContainsKey("客户QQ") = False Then
e.WriteString("客户电话、微信和QQ不能同时为空!")
Return""
End If
With wb.AddButtonGroup("form1", "btg1", True)
.Add("btn1", "确定", "button").Attribute = ""
End With
With wb.AddDialog("", "dlg1", "提示", "增加订单成功,是否继续增加?") '增加订单成功提示框
.AddButton("btnYes", "是").Attribute = ""
.AddButton("btnNo", "否", "list.htm").Kind = 1
End With
With wb.AddDialog("", "dlg2", "错误", "") '增加订单失败提示框 这里就是这样,还是需怎么更改呢?
.AddButton("btnOK", "确定")
End With
以下是引用有点蓝在2024/1/17 12:02:00的发言:
Dialog要放到上一个页面,也就是form1这个绑定所在的页面
然后这个函数里不要使用MsgPage或Dialog,直接返回错误文字即可,比如
Dim e As RequestEventArgs = args(0)
Dim wb As New weui
Dim nms() As String = {"姓名", "订单日期", "订单时间", "省份", "城市", "市", "地铁线", "地铁站", "出发确认", "本人介绍", "联系方式", "开房", "客户网名", "客服网名", "单价", "单位" , "收款方式", "交待事项" } '不能为空的列名数组
For Each nm As String In nms
If e.PostValues.ContainsKey(nm) = False Then '生成错误提示页
e.WriteString("增加失败", nm & "列不能为空!")
Return"" '必须返回
End If
Next
If e.PostValues.ContainsKey("客户电话") = False And e.PostValues.ContainsKey("客户微信") = False And e.PostValues.ContainsKey("客户QQ") = False Then
e.WriteString("客户电话、微信和QQ不能同时为空!")
Return""
End If
此主题相关图片如下:qq图片20240117122740.png
e.WriteString("增加失败," & nm & "列不能为空!")