以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  AddSelect如何实现多选呢?当前已经解决了值的获取及单选,怎么实现多选呢?  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=132228)

--  作者:李孝春
--  发布时间:2019/3/17 17:18:00
--  AddSelect如何实现多选呢?当前已经解决了值的获取及单选,怎么实现多选呢?

当前效果图:(点击备注可以弹出选择项,当前可以实现单选,求助什么实现多选呢?)

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

图片点击可在新窗口打开查看此主题相关图片如下:222.png
图片点击可在新窗口打开查看
具体代码如下(红色部分如何修正为可以多选呢?多个值选择后要能够达到这个格式:院领导,第一支部,党员)
Dim wb As New weui
Select Case e.Path
    Case "addnewtxl.htm"
        If e.PostValues.Count = 0 Then
            wb.AddForm("","form1","addnewtxl.htm")
            With wb.AddInputGroup("form1","ipg1","干警信息")
                .AddInput("姓名","姓名","Text") \'前一个"姓名"是ID,后一个"姓名"是标题
                .AddInput("电话","电话","number")
                .AddInput("电子邮件","电子邮件","text")
                Dim filter As String = "表名 = \'干警信息\' and 列名 = \'备注\' and 停用 = false"
                Dim fdr As DataRow = DataTables("列项设置").Find(filter)
                If fdr IsNot Nothing Then
                    Dim abc As String=fdr("下拉选项").replace(",", "|")
                    .AddSelect("备注","备注",abc)
                End If
            End With
            With wb.AddButtonGroup("form1","btg1",True)
                .Add("btn1", "确定", "submit")
            End With
        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
        With wb.AddMsgPage("","msgpage","增加成功", "好好学习,天天向上") \'生成成功提示页
            .AddButton("btn1","继续增加","addnewtxl.htm")
        End With 
        e.WriteString(wb.Build)
    End If
End Select

[此贴子已经被作者于2019/3/17 17:18:19编辑过]

--  作者:sjx71
--  发布时间:2019/3/17 21:37:00
--  
AddSelect只能实现单选,

可以用复选列表项实现多选

Select Case e.Path
    Case "test.htm"
        Dim wb As New weui
        wb.AddForm("","form1","test.htm")
        With wb.AddCheckGroup("form1","rdg1","浏览器")
            .Add("bw1","Intenet Explorer", True) \'默认勾选
            .Add("bw2","Google Chorme")
            .Add("bm3","FireFox")
            .Add("bm4","Safari").Enabled = False \'此项不可选
        End With
        With wb.AddButtonGroup("form1","btg1",True)
            .Add("btn1", "确定", "submit")
        End With
        e.WriteString(wb.Build) \'生成网页
End Select

--  作者:李孝春
--  发布时间:2019/3/17 22:17:00
--  回复:(sjx71)AddSelect只能实现单选,可以用复选列...
按照你的思路效果如下

图片点击可在新窗口打开查看此主题相关图片如下:4.png
图片点击可在新窗口打开查看
有没有办法实现下面的效果呢

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


--  作者:有点甜
--  发布时间:2019/3/18 10:16:00
--  

参考代码

 

Select Case e.Path
    Case "test.htm", ""
        Dim wb As New WeUI
        With wb.AddInputGroup("","ipg1","干警信息")
            .AddInput("姓名","姓名","Text").Attribute = "onclick=""show(\'dlg2\')"""
        End With
        Dim wb2 As New weui
        wb2.AddForm("","form2","test.htm")
        Dim ary() As String = {"数据1", "数据2", "数据3"}
        With wb2.AddCheckGroup("form2","rdg1","浏览器")
            For i As Integer = 0 To ary.length-1
                .Add("bm" & i, ary(i))
            Next
        End With
        With wb.AddDialog("","dlg2", "请选择",wb2.Build)
            .AddButton("btnCancel","取消").Kind = 1
            Dim str As String = ""
            str &= "var s = \'\';"
            For i As Integer = 0 To ary.length-1
                str &= "var c" & i & " = document.getElementById(\'bm" & i & "\').checked;"
                str &= "if(c" & i & "){s = s + \'," & ary(i) & "\'};"
            Next
            \'str &= "alert(s.substring(1));"
            str &= "姓名.value = s.substring(1)"
            \'msgbox(str)
            .AddButton("btnOK","确定").Attribute="onclick=""" & str & """"
        End With
        e.WriteString(wb.Build) \'生成网页
End Select


--  作者:李孝春
--  发布时间:2019/3/18 22:52:00
--  回复:(有点甜)参考代码 Select Case e.Pa...
Dim ary() As String = {"数据1", "数据2", "数据3"}  有点甜老师  如果这个数据4……数据15的话  那么页面悲催了,无法看见取消与确认的选择了
能不能实现如下图中红色框里面的格式呢?

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


--  作者:有点蓝
--  发布时间:2019/3/18 22:57:00
--  
weui无法实现这种
--  作者:有点蓝
--  发布时间:2019/3/18 23:07:00
--  
可以添加滚动条

Select Case e.Path
    Case "test.htm", ""
        Dim wb As New WeUI
        With wb.AddInputGroup("","ipg1","干警信息")
            .AddInput("姓名","姓名","Text").Attribute = """
        End With
        Dim wb2 As New weui
        wb2.AddForm("","form2","test.htm")
        Dim ary() As String = {"数据1", "数据2", "数据3"}
        wb2.InsertHTML("form2","<div id=\'div1\' style=\'overflow-y:auto;height:300px\'>")
        With wb2.AddCheckGroup("form2","rdg1","浏览器")
            For i As Integer = 0 To 10
                .Add("bm" & i, "数据" & i)
            Next
        End With
        wb2.InsertHTML("form2","</div>")
        With wb.AddDialog("","dlg2", "请选择",wb2.Build)
            .AddButton("btnCancel","取消").Kind = 1
            Dim str As String = ""
            str &= "var s = \'\';"
            For i As Integer = 0 To ary.length-1
                str &= "var c" & i & " = document.getElementById(\'bm" & i & "\').checked;"
                str &= "if(c" & i & "){s = s + \'," & ary(i) & "\'};"
            Next
            \'str &= "alert(s.substring(1));"
            str &= "姓名.value = s.substring(1)"
            \'msgbox(str)
            .AddButton("btnOK","确定").Attribute=" & str & """"
        End With
        e.WriteString(wb.Build) \'生成网页
End Select

--  作者:李孝春
--  发布时间:2019/3/18 23:07:00
--  回复:(有点蓝)weui无法实现这种
好的 谢谢有点蓝老师  我就不再纠结这样的方式了

那对于多个字段值的内容怎么操作呢?
比如我姓名字段值会有好几百个,怎么进行变通呢?

--  作者:有点蓝
--  发布时间:2019/3/18 23:12:00
--  
点击姓名,弹出一个窗口或者对话框,提供模糊查询功能,选择姓名后追加到文本框里
--  作者:李孝春
--  发布时间:2019/3/18 23:45:00
--  回复:(有点蓝)点击姓名,弹出一个窗口或者对话框,...
有点蓝老师有没有对应的weui模糊查询相关例子呢?