以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- [求助]搞了一天关于网页开发的代码,晕死了,老师救命 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=147023) |
-- 作者:huangfanzi -- 发布时间:2020/3/7 22:37:00 -- [求助]搞了一天关于网页开发的代码,晕死了,老师救命 实在没办法了,请老师帮我做个例子吧,以下是我目前写的代码: HttpRequest事件代码: Case "Xdcg_jbxx.htm" Functions.Execute("下单常规基本信息录入",e) “下单常规基本信息录入”函数代码: Dim e As RequestEventArgs = args(0) Dim wb As New WeUI If e.PostValues.Count = 0 Then wb.AddForm("","form1","Xdcg_jbxx.htm") With wb.AddInputGroup("form1","ipg1","") With .AddSelect("公司","公司","|" & _dt销售合同.SQLGetComboListString("公司","[合同类型] = \'常规\' And [执行状态] = \'执行中\' And [供货完结] = 0 And [业务员] = \'" & _UserName & "\'")) .Attribute = """ End With With .AddSelect("工程名称","工程名称","") .Attribute = """ End With .AddSelect("浇注部位","浇注部位","") .AddInput("业务员电话","业务员电话","text").Value = "123456789" End With With wb.AddButtonGroup("form1","btg1",False) .Add("btn1", "下一步", "submit") .Add("btn2", "返回", "", "default.htm") End With 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 e.WriteString(wb.Build) End If 目前代码级联一切正常,现在遇到二个问题: 1、如果我删除 .AddInput("业务员电话","业务员电话","text").Value = "123456789" 这行代码并且打开网页后不选择公司名,点”下一步“后不会出现”公司列不能为空“的报错,必须选择公司名后再直接点”下一步“才会出现”工程名称列不能为空“的报错,反之加上这行代码后公司名不选择就会报错,实现的代码的本意,实在搞不懂怎么回事 2、关于提交后的数据处理,帮助文件看了好几天了,还是没搞懂,还是请老师直接帮我做个例子 假定有个网页,名字是"test.htm",在这个网页上有个 Case "test.htm" Dim wb As New WeUI With wb.AddArticle("","ar1") .AddTitle("h1","公司") .AddTitle("h1","工程名称") End With e.WriteString(wb.Build) \'生成网页 我现在希望"Xdcg_jbxx.htm"的网页上选择公司及工程名称后点”下一步“,然后跳到这个"test.htm"上,并且将之前选择的公司及工程名直接赋值给AddArticle使用,换句话说,我如何把"Xdcg_jbxx.htm"所提交的数据找个地方存下,然后在别的地方使用,这样在后续的网页中就能将这个变量作为条件判断使用,如SQLFind 请老师务必帮我做个例子,纠结好几天了,万分感谢! |
-- 作者:有点蓝 -- 发布时间:2020/3/8 20:51:00 -- 1、如果什么都没有填写,也就是没有提交任何数据,这时符合If e.PostValues.Count = 0 Then的判断,不会执行else后面的判断,当然就不会有提醒了,这个处理是合理的,既然都没有提交数据,页面也就没有什么操作,直接返回原页面。 2、 HttpRequest事件代码: Case "Xdcg_jbxx.htm" Functions.Execute("下单常规基本信息录入",e) Case "test.htm" ‘判断由Xdcg_jbxx.htm页面提交的数据 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","返回","Xdcg_jbxx.htm") \'如果有问题,返回Xdcg_jbxx.htm页面 End With e.WriteString(wb.Build) Return "" \'必须返回 End If Next Dim wb As New WeUI With wb.AddArticle("","ar1") .AddTitle("h1",e.PostValues.ContainsKey("公司") ) \'显示提交的数据 .AddTitle("h1",e.PostValues.ContainsKey("工程名称") ) End With e.WriteString(wb.Build) \'生成网页 -------------------- "下单常规基本信息录入"函数代码: Dim e As RequestEventArgs = args(0) Dim wb As New WeUI wb.AddForm("","form1","test.htm") \'把数据提交到test.htm页面 With wb.AddInputGroup("form1","ipg1","") With .AddSelect("公司","公司","|" & _dt销售合同.SQLGetComboListString("公司","[合同类型] = \'常规\' And [执行状态] = \'执行中\' And [供货完结] = 0 And [业务员] = \'" & _UserName & "\'")) .Attribute = "" ‘这些1楼发帖时被论坛屏蔽了,自己补上 End With With .AddSelect("工程名称","工程名称","") .Attribute = "" End With .AddSelect("浇注部位","浇注部位","") .AddInput("业务员电话","业务员电话","text").Value = "123456789" End With With wb.AddButtonGroup("form1","btg1",False) .Add("btn1", "下一步", "submit") .Add("btn2", "返回", "", "default.htm") End With e.WriteString(wb.Build) \'生成网页 |