以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  如下代码,为什么弹出错误? 为什么数据没有post到表单中来?  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=103236)

--  作者:ycwk
--  发布时间:2017/7/3 20:34:00
--  如下代码,为什么弹出错误? 为什么数据没有post到表单中来?

  \'这两行依次弹出   设备类型   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

 


--  作者:有点蓝
--  发布时间: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"