以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  用户点击取消时,把cookies("SN") 清除,请问要怎么弄?  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=131129)

--  作者:ycwk
--  发布时间:2019/2/18 10:06:00
--  用户点击取消时,把cookies("SN") 清除,请问要怎么弄?
     With wb.AddDialog("","dlg4", "重新盘点确认","您确定要对当前设备重新盘点吗?")
            .AddButton("btnCancel","取消").Kind = 1
            .AddButton("btnOK","继续","./CheckPd.htm?SN=" & e.Cookies("SN") )
     End With
[此贴子已经被作者于2019/2/18 10:06:23编辑过]

--  作者:ycwk
--  发布时间:2019/2/18 10:11:00
--  
或者不用cookie,怎么获取 网页控件ID为  sn 的字段值?

Dim e As RequestEventArgs = args(0)
Dim wb As New weui
wb.DeleteCookie("SN")

If e.Cookies.ContainsKey("username") Or e.Cookies.ContainsKey("password")  Then   \'如果cookie里面有 username 和 password字段
     wb.AddForm("","form1","CheckPd.htm")     \'.Attribute=""        \' 由CheckPd接收提交的数据


     With wb.AddInputGroup("form1","ipg1","请扫描设备标签上的二维码")
         .AddInput("SN","SN","Text").Attribute="""
         .AddHidenValue("test","test")    \'为了避免一扫描就跳转,添加的干扰代码
     End With


     With wb.AddButtonGroup("form1","btg1",True)   \'显示  待用户扫描的界面
        .Add("btnOK","确定","button").Attribute=""         \'button千万不能写成submit,否则就会造成数据提交两遍
        .Add("btn1", "退出登录", "button","./exit.htm")    \'返回原页面
     End With




    \'当扫描到没有收录的二维码时,给出不存在的提示
     With wb.AddDialog("","dlg3", "错误","") \'增加订单失败提示框
            .AddButton("btnOK","确定")
     End With



    \'存在重复盘点记录时,给出是否重新盘点的提示.
     With wb.AddDialog("","dlg4", "重新盘点确认","您确定要对当前设备重新盘点吗?")
            .AddButton("btnCancel","取消").Kind = 1
            .AddButton("btnOK","继续","./CheckPd.htm?SN=" & e.Cookies("SN") )
     End With



     wb.InsertHTML("<script>assetnumber.focus(); </script>")
     wb.AppendHTML("<script src=\'./ajax/libs/pdScan.js\'></script>")   \'引入脚本文件          
     e.WriteString(wb.Build)


Else 

    wb.InsertHTML("<meta http-equiv=\'Refresh\' c>")      \'如果不含username或password的cookies,那就直接跳转到登录界面
    e.WriteString(wb.Build) \'生成网页



End If

--  作者:有点蓝
--  发布时间:2019/2/18 11:22:00
--  
要使用ajex提交数据,参考:http://www.foxtable.com/mobilehelp/scr/0103.htm

如:
.AddButton("btnOK","继续","button" ).Attribute = "onclick=\'CheckPd()\'"

js文件

Function CheckPd(){
    var result= submitAjaxFileds(\'CheckPd.htm\',\'\',\'sn\',false);
    If(result){
        form1.reset();
    }
}