以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  页面显示问题求助  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=146731)

--  作者:aidimeng
--  发布时间:2020/3/1 12:47:00
--  页面显示问题求助

今天刚刚开始准备学习移动端开发,很不入门,仿照例子做了个简单的页面,能实现数据提交,但有几个问题想咨询下

 

 如下图,


图片点击可在新窗口打开查看此主题相关图片如下:1.png
图片点击可在新窗口打开查看
可以实现一次定多个品牌不同数据的产品
[此贴子已经被作者于2020/3/1 12:58:12编辑过]

--  作者:有点蓝
--  发布时间:2020/3/1 22:23:00
--  
比如:
        With wb.AddInputGroup("form1","ipg1","登录")
            .AddInput("xm","户名2","text").Attribute = "style=\'background-color: red;\'"
            .AddInput("pw","密码","password")
        End With

--  作者:aidimeng
--  发布时间:2020/3/2 9:06:00
--  
谢谢甜老师,页面我处理好了,我想在页面上加上业务员,能不能实现通过扫描二维码获取页面地址,并把业务员的名字带出来啊
--  作者:有点蓝
--  发布时间:2020/3/2 9:46:00
--  
扫码需要借助微信公众号:http://www.foxtable.com/mobilehelp/topics/0247.htm
--  作者:aidimeng
--  发布时间:2020/3/2 10:36:00
--  

谢谢甜老师,我没有那么实现,手上没有公共账号

我利用e.values 实现的。可以带出对应的业务员

 

但在列表中遇到个问题

 With wb.AddInputGroup("form1","ipg11","订货信息")
                With .AddSelect("品牌","品牌","|" & DataTables("表A").GetComboListString("品牌"))
                    .Attribute = """
                   
                End With
就是每次选择品牌的时候 后台都报错,列表中包含一个空的选项,我看了数据库,里面没有空值

这个怎么处理啊


--  作者:有点蓝
--  发布时间:2020/3/2 10:48:00
--  
.Attribute = """这里是什么内容?触发了什么操作,相关代码发上来
--  作者:aidimeng
--  发布时间:2020/3/2 11:07:00
--  

 


图片点击可在新窗口打开查看此主题相关图片如下:qq截图20200302110452.png
图片点击可在新窗口打开查看
谢谢甜老师,我找到错误的地方了,难怪报错呢。谢谢 id写错了
[此贴子已经被作者于2020/3/2 11:11:51编辑过]

--  作者:aidimeng
--  发布时间:2020/3/2 19:03:00
--  

Dim wb As New weui
Dim gsid As Integer
Dim ywid As Integer
Select Case e.Path
    Case "addnew.htm"
 
        If e.PostValues.Count = 0 Then
            \'Dim sb As New StringBuilder
            \'sb.AppendLine("接收到的数据有:<br/><br/>")
            For Each key As String In e.Values.Keys
                Select Case key
                    Case "gs"
                        gsid= e.Values(key)
Vars("gsid")=gsid
                    Case "yw"
                        ywid= e.Values(key)
Vars("ywid")=ywid
                End Select
                \'sb.AppendLine(key & "=" & e.Values(key) & "<br/>")
            Next
            \'e.WriteString("公司ID="& gsid &" And 员工ID= "& ywid &"")
            Dim r As DataRow= DataTables("员工表").Find("公司ID="& gsid &" And 员工ID= "& ywid &"")
            Dim fname As String= r("员工姓名")
           
           
           
            wb.AddForm("","form1","addnew.htm")   \'.Attribute = "style=\'background-color: red;\'"
            With wb.AddInputGroup("form1","ipg1","客户资料")
                .AddInput("姓名","姓名","Text")    \'.Attribute = "style=\'background-color: red;\'"
                \'前一个"姓名"是ID,后一个"姓名"是标题
                .AddInput("联系电话","联系电话","text")
                .AddInput("交货日期","交货日期","date")
                .AddInput("配送地址","配送地址","text")
               
            End With
           
            With wb.AddInputGroup("form1","ipg11","订货信息")
                With .AddSelect("品牌","品牌","|" & DataTables("表A").GetComboListString("品牌"))
                    .Attribute = """
                   
                End With
                .AddInput("数量","数量","number") \'前一个"姓名"是ID,后一个"姓名"是标题
                With .AddInput("yw","业务员","text")
                    .Value = fname
                    .Readonly= True
                End With
               
            End With
           
           
           
           
            With wb.AddButtonGroup("form1","btg1",True)
                .Add("btn1", "确定", "submit")
            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
            nms = New String() {"姓名","联系电话","交货日期","配送地址","数量","品牌"} \'重新定义了nms数组,增加了两列.
            Dim dr As DataRow = DataTables("订货单").AddNew()
            For Each nm As String In nms
                If e.PostValues.ContainsKey(nm) Then
                    dr(nm) = e.PostValues(nm)
                End If
            Next
            \'以下代码处理品牌复选列表项
            \'Dim pp As String
            \'nms = New String() {"5L香谷坊花生油","5L香谷坊非转一级大豆油","5L福之泉一级大豆油","10L福临门非转一级大豆油"} \'将nms重新定义为品牌数组
            \'For Each nm As String In nms
            \'If e.PostValues.ContainsKey(nm) AndAlso e.PostValues(nm).Trim() = "on" Then \'不能省略Trim
            \'pp = pp & nm  & ","
            \'End If
            \'Next
            \'If pp > "" Then
            \'dr("品牌") = pp.Trim(",")
            \'End If
            \'\'保存并生成增加成功提示页面
            dr.save()
            \'e.WriteString("addnew.htm?GS="& GSID &" & YW="& YWID &"")
            With wb.AddMsgPage("","msgpage","提交成功", "祝你愉快每一天") \'生成成功提示页
                .AddButton("btn1","继续增加","addnew.htm?gs="& Vars("gsid") &"&yw="& vars("ywid") &"")
               
            End With
            e.WriteString(wb.Build)
        End If
End Select

 

我在测试的过程中有时很正常,多人访问时 软件报错Object reference not set to an instance of an object.  此时页面就不动了,我关掉报错可以继续

 

是代码中哪里有问题吗

过程图片

 


图片点击可在新窗口打开查看此主题相关图片如下:1.jpg
图片点击可在新窗口打开查看

图片点击可在新窗口打开查看此主题相关图片如下:2.jpg
图片点击可在新窗口打开查看

图片点击可在新窗口打开查看此主题相关图片如下:3.jpg
图片点击可在新窗口打开查看
[此贴子已经被作者于2020/3/2 19:12:59编辑过]

--  作者:有点蓝
--  发布时间:2020/3/2 20:13:00
--  
1、报错Object reference not set to an instance of an object,一般是使用了空对象,比如是使用find查询却没有判断结果是否有值

Dim r As DataRow= DataTables("员工表").Find("公司ID="& gsid &" And 员工ID= "& ywid &"")
if r isnot nothing ‘缺少这个判断’
Dim fname As String= r("员工姓名")

2、图1的提示是微信的要求,服务端地址必须是备案的域名才不会有这种提示

3、页面空白一般是代码出错,或者是重复调用了e.writestring导致

--  作者:aidimeng
--  发布时间:2020/3/3 8:37:00
--  
谢谢您 我检查下代码