以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 页面数据填写完成后 数据写入数据库 页面为空白 没有显示对应的友情提示语 何解? (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=168876) |
-- 作者:cnsjroom -- 发布时间:2021/5/25 15:26:00 -- 页面数据填写完成后 数据写入数据库 页面为空白 没有显示对应的友情提示语 何解? 页面数据填写完成后 数据写入数据库 页面显示为OK 没有显示对应的友情提示语 好好学习,天天向上! 也没有正常返回testyzm页面 便于新提交数据 何解? 红色部分代码没有正常显示出来 ,麻烦老师帮忙看看 谢谢! testyzm.htm页面代码: Dim e As RequestEventArgs = args(0) Dim wb As New weui Dim uuid As String = Guid.NewGuid.TOstring() wb.AddTopTips("","toptip1","请输入手机号和验证码!") If e.PostValues.Count = 0 Then wb.Title = "生态环境和资源保护领域" wb.AddForm("","form1","testyzm.htm").Attribute = "onsu bmit=\'return valid()\'" With wb.AddInputGroup("form1","ipg212","") With .AddInput("举报类型","举报类型","text") .Readonly=True .Value="生态环境和资源保护领域" End With .AddInput("线索地点","线索地点*","text").PlaceHolder = "请输入准确的地址" .AddInput("位置描述","位置描述*","text").PlaceHolder = "请输入地址辅助性说明" End With With wb.AddInputGroup("form1","ipg22","线索描述*") With .AddTextArea("bz",5) .Placeholder = "请准确输入线索描述……" End With End With With wb.AddInputGroup("form1","ipg2","图片或视频上传") \'文件上传 With.AddUploader("up1","",True) \'True表示允许上传多个文件 .AllowDelete = True \'允许删除 .Incremental = True \'允许重复选择文件或连续拍照 .ScaleWidth = 1024 End With Dim sb As New StringBuilder sb.appendLine("<div>") sb.appendLine("单文件上传: <input type=\'file\' name=\'up1\' id=\'up1\'><br/>") sb.appendLine("多文件上传: <input type=\'file\' name=\'up2\' id=\'up2\' multiple>") sb.appendLine("</div>") wb.InsertHTML("form1",sb.ToString) End With Dim rdg As ExWeUI.ExRadioGroup = ExWeUI.WebUI.AddRadioGroup("form1","rdg1","是否实名举报</span>") rdg.add("rd1","实名举报").Attribute = "onch ange=\'jubaoxianshi()\'" rdg.add("rd2","匿名举报",True).enabled = True wb.InsertHTML("form1",rdg.BuildHtml) With wb.AddInputGroup("form1","ipg100","") With .AddInputCell("ic3") \'通过InputCell增加输入框 .AddLabel("ljbr","举报人",0) \'增加标签,0显示在左边 .AddInput("jbr","text",1).PlaceHolder = "请输入真实姓名" \'增加输入框,1表示显示在中间 End With End With With wb.AddInputGroup("form1","ipg12","") With .AddInputCell("ic6") \'通过InputCell增加输入框 .AddLabel("lsj","联系电话",0) \'增加标签,0显示在左边 .AddInput("sjh","text",1).PlaceHolder = "请输入联系电话" \'增加输入框,1表示显示在中间 .AddVcodeButton("vyz","获取验证码",2).Attribute="on click=\'getNum()\'" End With With .AddInputCell("ic7") \'通过InputCell增加输入框 .AddLabel("lyzm","验证码",0) \'增加标签,0显示在左边 .AddInput("yzm","text",1).PlaceHolder = "请输入短信中的验证码" \'增加输入框,1表示显示在中间 End With End With Dim rdg1 As ExWeUI.ExRadioGroup = ExWeUI.WebUI.AddRadioGroup("form1","rdg2","是否申请奖励</span>") rdg1.add("rd11","申请奖励").Attribute = "onc hange=\'jianglixianshi()\'" rdg1.add("rd21","不申请奖励",True).enabled = True wb.InsertHTML("form1",rdg1.BuildHtml) Dim bt As String ="根据《奖励办法(试行)》对符合条件的线索进行奖励,点击获取《奖励办法(试行)》详情.注:领取奖励需要实名" With wb.AddInputGroup("form1","ipg222","申请奖励须知") With .AddTextArea("bz1",3) .Readonly=True .Value= bt End With End With With wb.AddButtonGroup("form1","btg1",True) .Add("btn1", "确定", "submit").Attribute= "onc lick=\'submitForm3()\'" \'调用js函数上传 End With \'With wb.AddButtonGroup("form1","btg1",False) \'.Add("btn1", "确定上传", "button").Attribute= "onc lick=\'submitForm3()\'" \'调用js函数上传 \'.Add("btn2", "取消上传", "submit").FormAction = "default.htm" \'wb.InsertHTML("<div id=\'someelement\'></div>") \'End With With wb.AddDialog("","dlg1", "增加成功","好好学习,天天向上!") .AddButton("btnOK","继续增加","testyzm.htm") End With wb.AddToast("","tst1", "正在上传",1) wb.AddToast("","tst2", "上传成功",0) wb.AddToast("","tst3", "上传失败",0).Icon= "warn" wb.AppendHTML("<script>" & vars("yanzhengma") & "</script>") \'引入脚本文件 wb.AppendHTML("<script>" & vars("jubao") & "</script>") \'引入脚本文件 e.WriteString(wb.Build) \'生成网页 Else Dim st As New Date(1970,1,1,8,0,0) Dim d As Date = cdate("2020-02-01") Dim t As Long = (Date.Now - st).TotalSeconds() dim a as boolean = e.PostValues.ContainsKey("rd1") Dim a1 As Boolean=e.PostValues.ContainsKey("rd2") Then Dim a12 As Boolean=e.PostValues.ContainsKey("rd11") Then Dim a13 As Boolean=e.PostValues.ContainsKey("rd21") Then Dim cmd As New SQLC ommand cmd.Connect ionN ame = "智慧党建" cmd.CommandText = "Ins ert Into 线索举报 (uuid,举报类型,线索地点,位置描述,线索描述,实名举报,匿名举报,联系人,联系电话,验证码,申请奖励,不申请奖励,举报时间) Values(?,?,?,?,?,?,?,?,?,?,?,?,?)" cmd.Parameters.Add("@uuid", uuid) MessageBox.Show(a) cmd.Parameters.Add("@举报类型", e.PostValues("举报类型")) cmd.Parameters.Add("@线索地点", e.PostValues("线索地点")) cmd.Parameters.Add("@位置描述", e.PostValues("位置描述")) cmd.Parameters.Add("@线索描述", e.PostValues("bz")) cmd.Parameters.Add("@实名举报", a) cmd.Parameters.Add("@匿名举报", a1) cmd.Parameters.Add("@联系人", e.PostValues("jbr")) cmd.Parameters.Add("@联系电话", e.PostValues("sjh")) cmd.Parameters.Add("@验证码", e.PostValues("yzm")) cmd.Parameters.Add("@申请奖励", a12) cmd.Parameters.Add("@不申请奖励", a13) cmd.Parameters.Add("@举报时间",Date.now) cmd.ExecuteNonQuery For Each key As String In e.Files.Keys If key = "up1" Then For Each fln As String In e.Files(key) Dim wj As String =ProjectPath & "Attachments\\" & fln e.SaveFile(key,fln,wj) Dim cmd1 As New SQLC ommand cmd1.ConnectionN ame = "智慧党建" cmd1.CommandText = "Ins ert Into web上传图片附件 (会议编号,时间戳,图片名称,图片类别,图片) Values(?,?,?,?,?)" cmd1.Parameters.Add("@会议编号", uuid) cmd1.Parameters.Add("@时间戳", t) cmd1.Parameters.Add("@图片名称", FileSys.GetName(wj)) cmd1.Parameters.Add("@图片类别", e.PostValues("举报类型")) Dim ImageByte() As Byte = System.IO.File.ReadAllBytes(wj) \'读取文件流,并将读到的二进制数据放入数组ImageByte中, cmd1.Parameters.Add("@图片", ImageByte) cmd1.ExecuteNonQuery Next End If If key = "up2" Then For Each fln As String In e.Files(key) Dim wj As String =ProjectPath & "Attachments\\" & fln e.SaveFile(key,fln,wj) Dim cmd1 As New SQLC ommand cmd1.Connecti cmd1.CommandText = "Ins ert Into web上传图片附件 (会议编号,时间戳,图片名称,图片类别,图片) Values(?,?,?,?,?)" cmd1.Parameters.Add("@会议编号", uuid) cmd1.Parameters.Add("@时间戳", t) cmd1.Parameters.Add("@图片名称", FileSys.GetName(wj)) cmd1.Parameters.Add("@图片类别", e.PostValues("举报类型")) Dim ImageByte() As Byte = System.IO.File.ReadAllBytes(wj) \'读取文件流,并将读到的二进制数据放入数组ImageByte中, cmd1.Parameters.Add("@图片", ImageByte) cmd1.ExecuteNonQuery Next End If Next e.WriteString("OK") \'e.WriteString(wb.Build) \'生成网页 DataTables("线索举报").load End If js代码如下:(也没有成功返回对应的页面testyzm.htm) function submitForm3(){ show("tst1",2000); if (document.getElementById("yzm").value && document.getElementById("sjh").value ){ submitAjaxForm(\'form1\',\'afterSubmit3\'); } else{ show("toptip1",2000); } } function afterSubmit3(result){ hide("tst1"); if (result==\'OK\') { show("tst2"); location="testyzm.htm"; } else{ show("tst3",2000); } } [此贴子已经被作者于2021/5/25 15:28:00编辑过]
|
-- 作者:有点蓝 -- 发布时间:2021/5/25 15:47:00 -- 没看到上面代码哪里有调用打开这个提示窗口的用法: http://www.foxtable.com/mobilehelp/topics/0080.htm http://www.foxtable.com/mobilehelp/topics/0102.htm 比如: if (result==\'OK\') { show(\'dlg1\')
|
-- 作者:cnsjroom -- 发布时间:2021/5/25 16:32:00 -- 回复:(有点蓝)没看到上面代码哪里有调用打开这个提... 是在js代码里面 写了个正在上传tst1 tst2 tst3 三个状态 然后会页面显示ok 对应的数据会往数据库写两次相同的数据? 多种方法都试过了 都没有很好解决 总觉得哪里不对 又总找不到原因 麻烦老师指导下了 1:确定 这个地方又要保证数据提交正常 且值写入一次即可 又要提示文件上传状态的提示 2:数据成功保存后,页面不要显示ok,显示ok就会再次写入一次数据。数据保存后,直接返回dlg1,提醒用户提交成功, 用户点击确定后进入testyzm新页面。便于新数据的填写
|
-- 作者:有点蓝 -- 发布时间:2021/5/25 16:41:00 -- 如果调用ajax,就不要使用submit With wb.AddButtonGroup("form1","btg1",True) .Add("btn1", "确定", "button").Attribute= "onc lick=\'submitForm3()\'" \'调用js函数上传 End With |
-- 作者:cnsjroom -- 发布时间:2021/5/25 16:49:00 -- 回复:(有点蓝)如果调用ajax,就不要使用submitWith... 谢谢老师 |