Foxtable(狐表)用户栏目专家坐堂 → 如下代码,为什么弹出错误? 为什么数据没有post到表单中来?


  共有1879人关注过本帖树形打印复制链接

主题:如下代码,为什么弹出错误? 为什么数据没有post到表单中来?

帅哥哟,离线,有人找我吗?
ycwk
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:六尾狐 帖子:1228 积分:8561 威望:0 精华:0 注册:2016/2/2 21:52:00
如下代码,为什么弹出错误? 为什么数据没有post到表单中来?  发帖心情 Post By:2017/7/3 20:34:00 [只看该作者]

  '这两行依次弹出   设备类型   True    cpu   false   为什么没有post过来呢?



Dim e As RequestEventArgs = args(0)

Dim wb As New weui

 

        wb.Title="终端管理表数据提交"

 

        wb.InsertHTML("<div data-theme='g' data-role='page' data-position='fixed'>")     

If e.PostValues.Count = 0 Then '生成增加调查表网页

  

    wb.AddForm("","form1","PcManage.htm").Attribute=""             

     

    With wb.AddInputGroup("form1","ipg1","资料")       'ipg1 和下面的ipg2 ipg3名称一定不能重,重了就弹不出网页

            .AddSelect("设备类型","设备类型","笔记本|台式机|一体机")

            .AddInput("CPU","CPU","Text")

            .AddInput("内存","内存","Text")

            .AddInput("所在楼","所在楼","Text")

            .AddInput("所在科室","所在科室","Text")

            .AddInput("所在房间","所在房间","Text")

            .AddInput("电脑用途","电脑用途","Text")

            .AddInput("常用人","CPU","Text")

            .AddInput("外网计算机名","外网计算机名","Text")

            .AddInput("外网IP","外网IP","Text")

            .AddInput("外网MAC","外网MAC","Text")

            .AddInput("内网计算机名","内网计算机名","Text")

            .AddInput("内网IP","内网IP","Text")

            .AddInput("内网MAC","内网MAC","Text")

            .AddInput("启用时间","启用时间","Text")

            .AddInput("软件环境","软件环境","Text")

            .AddInput("资产归属","资产归属","Text")

    End With

 

    With wb.AddInputGroup("form1","ipg2","备注")

            .AddTextArea("备注",3).Placeholder = "请输入100字以内的备注"      '3为默认为3

    End With

 

 

   With wb.AddButtonGroup("form1","btg1",True)

        .Add("btn1", "确定", "submit")                  

 

    With wb.AddDialog("","dlg3", "","")   

            .AddButton("btnYes","").Attribute = ""

            .AddButton("btnNo","","ApplyService.htm").Kind = 1

    End With

 

 

            .AddButton("btnOK","确定")                             End With

 

   wb.AppendHTML("<script src='../ajax/libs/ajaxform.js'></script>") '引入脚本文件              

   e.WriteString(wb.Build)

 

 

Else '保存新增的调查单

         Dim nms() As String = {"设备类型","CPU","内存","所在楼","所在科室","所在房间"}  

            For Each nm As String In nms

                   msgbox(nm)

              

                   msgbox(e.PostValues.ContainsKey(nm))                 

                

                If e.PostValues(nm)="" Then '生成错误提示页

               

 

                    e.WriteString("请输入" & nm & "!")

 

                    Return "wrong"   '必须返回                          End If

            Next

 

 

 

    nms= new String(){"设备类型","CPU","内存","所在楼","所在科室","所在房间","电脑用途","常用人","内网计算机名","内网IP","内网MAC","外网计算机名","外网IP","外网MAC","启用时间","资产归属","软件环境","备注"}

    Dim dr As DataRow = DataTables("PM终端设备管理表").AddNew()

    For Each nm As String In nms

        dr(nm) = e.PostValues(nm)

    Next

    dr.Save()

 

    e.WriteString("ok")

End If

 


 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:110592 积分:562856 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2017/7/3 20:41:00 [只看该作者]

Dim nms() As String = {"设备类型","cpu","内存","所在楼","所在科室","所在房间"}  'cpu必须是小写


增加文本输入框的语法为:

AddInput(ID, Label, type)

ID输入框ID,注意生成网页时,WeUI会自动将所有ID转换为小写,例如"Table1"或转换为"table1",今后不再重复提示,大家请自行留意。
Label在输入框左侧显示的标签内容
Type输入框类型,普通文本输入框设置为"text",密码输入框设置为"password"

 回到顶部