如下所示代码,有2个或以上按键时,如果判断输入值的是否有效,并进行下一步。(下面的代码,能判断输入值并作出提示,当输入值有效时不能继续下去)
....
If e.PostValues.Count = 0 Then
Dim dr As DataRow = DataTables("设备点检").SQLFind("[编号]= '"& str2 &"'")
If dr IsNot Nothing Then
wb.AddTopTips("","toptip1","未按要求填写数据!") '用于显示动态错误提示
wb.AddForm("","form1","./bb.htm?tp=" & tp & "&str=" & str)
With wb.AddInputGroup("form1","ipg1","设备名称")
With .AddTextArea("设备名称",1)
.Value = dr("设备名称")
.Readonly = True
End With
End With
With wb.AddInputGroup("form1","ipg2","编号")
With .AddTextArea("编号",1)
.Value = dr("编号")
.Readonly = True
End With
End With
If tp2 = "ysj"
With wb.AddInputGroup("form1","ipg10","点检项目(必填)")
.AddSelect("txt1","周边环境","|正常|异常")
End With
With wb.AddButtonGroup("form1","btg1",False)
With .Add("btn1","存档1","button")
.Kind = 2
.Attribute= "o n click='getcheck1()'" '调用js函数上传
End With
.Add("btn4", "退出").Attribute = "o n c lick = ""WeixinJSBridge.call('closeWindow')"""
End With
ElseIf tp2 = "kt" Then
With wb.AddInputGroup("form1","ipg11","点检项目(必填)")
.AddSelect("txt1","机台外观","|正常|异常")
.AddSelect("txt2","面板功能","|正常|异常")
End With
With wb.AddButtonGroup("form1","btg1",False)
With .Add("btn1","存档2","button")
.Kind = 2
.Attribute= "o n click='getcheck2()'" '调用js函数上传
End With
.Add("btn4", "退出").Attribute = "o n c lick = ""WeixinJSBridge.call('closeWindow')"""
End With
End If
End If
wb.AppendHTML("<script src='./lib/check.js'></script>")
Else '保存数据
.....
End If
e.WriteString(wb.Build) '生成网页
js代码如下所示:
function getcheck1(){
var v1 = document.getElementById("txt1").value;
if (v1){return true}
show("toptip1",2500); //2500毫秒=2.5秒
return false;
}
function getcheck2(){
var v1 = document.getElementById("txt1").value;
var v2 = document.getElementById("txt2").value;
if (v1 && v2){return true}
show("toptip1",2500); //2500毫秒=2.5秒
return false;
}
[此贴子已经被作者于2017/11/2 21:09:24编辑过]