以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  AppendCookie问题  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=176654)

--  作者:cd_tdh
--  发布时间:2022/4/21 16:54:00
--  AppendCookie问题

老师,我两个页面,第一个Shigong_daily.htm,内部函数如下:

Dim e As object = args(0)
Dim wb As New weui
wb.AddForm("","form1","Shigong_daily.htm")
With wb.AddInputGroup("form1","ipg1","数据筛选")   \'ParentID 父容器的ID,如果是顶层对象,设置为""即可. ID 分组ID. Text 可选参数,用于指定分组标题.
    .AddInput("startdate","开始日期","date").Placeholder = "请选择要查询的开始日期"
    .AddInput("enddate","结束日期","date").Placeholder = "请选择要查询的结束日期"
End With
With wb.AddButtonGroup("form1","btg1",False)
    .Add("btn1", "首页", "", "default.htm")
    .Add("btn2", "筛选", "", "Shigong_daily_filter")
    .Add("btn3", "新增", "", "Shigong_daily_add.htm")
End With
If e.PostValues.ContainsKey("startdate") Then
    wb.AppendCookie("startdate", e.PostValues("startdate"))
Else
    wb.DeleteCookie("startdate")
End If
If e.PostValues.ContainsKey("enddate") Then
    wb.AppendCookie("enddate", e.PostValues("enddate"))
Else
    wb.DeleteCookie("enddate")
End If
e.WriteString(wb.Build)

点击筛选跳转到第二个页面:Shigong_daily_filter.htm,代码如下,通过Cookie怎么传值,第二个页面的日期,按照第一个页面的日期来筛选数据

Dim e As object = args(0)
Dim wb As New weui
wb.AddForm("","form1","Shigong_daily_filter.htm")
Dim drs As  List(of  DataRow) = DataTables("施工日志").SQLSelect("项目名称 = \'" & _Userxmmc & "\'And 日期>= \'" & e.Cookies("startdate") & "\' And  日期 <= \'" & e.Cookies("enddate") & "\'","","_Identify")
For Each dr As DataRow In drs
    With wb.AddInputGroup("form1",dr("_Identify"),"施工日志信息")
        .AddInput("日期","日&emsp;&emsp;期","date").Value = dr("日期")
        .AddInput("白天天气","白天天气","text").Value = dr("白天天气")
        .AddInput("白天气温","白天气温","text").Value = dr("白天气温")
        .AddInput("夜晚天气","夜晚天气","text").Value = dr("夜晚天气")
        .AddInput("夜晚气温","夜晚气温","text").Value = dr("夜晚气温")
        .AddTextArea("生产情况记录",5).Value = dr("生产情况记录")
        .AddTextArea("技术质量安全工作记录",5).Value = dr("技术质量安全工作记录")
        .AddInput("登记人","登&ensp;记&ensp;人","text").Value = dr("登记人")
        .AddInput("登记日期","登记日期","date").Value = dr("登记日期")
    End With
Next
With wb.AddButtonGroup("form1","btg1",True)
    .Add("btn1", "首页", "", "default.htm")
    .Add("btn2", "返回", "", "Shigong_daily.htm")
End With
e.WriteString(wb.Build)

 

 

 

[此贴子已经被作者于2022/4/21 16:55:45编辑过]

--  作者:有点蓝
--  发布时间:2022/4/21 17:07:00
--  

Dim e As object = args(0)
Dim wb As New weui
wb.AddForm("","form1","Shigong_daily_filter.htm")
With wb.AddInputGroup("form1","ipg1","数据筛选")   \'ParentID 父容器的ID,如果是顶层对象,设置为""即可. ID 分组ID. Text 可选参数,用于指定分组标题.
    .AddInput("startdate","开始日期","date").Placeholder = "请选择要查询的开始日期"
    .AddInput("enddate","结束日期","date").Placeholder = "请选择要查询的结束日期"
End With
With wb.AddButtonGroup("form1","btg1",False)
    .Add("btn1", "首页", "", "default.htm")
    .Add("btn2", "筛选", "submit")
    .Add("btn3", "新增", "", "Shigong_daily_add.htm")
End With
e.WriteString(wb.Build)

点击筛选跳转到第二个页面:Shigong_daily_filter.htm,代码如下,通过Cookie怎么传值,第二个页面的日期,按照第一个页面的日期来筛选数据

Dim e As object = args(0)
Dim wb As New weui
wb.AddForm("","form1","Shigong_daily_filter.htm")
Dim drs As  List(of  DataRow) = DataTables("施工日志").SQLSelect("项目名称 = \'" & _Userxmmc & "\'And 日期>= \'" & e.PostValues("startdate") & "\' And  日期 <= \'" & e.PostValues("enddate") & "\'","","_Identify")
For Each dr As DataRow In drs
    With wb.AddInputGroup("form1",dr("_Identify"),"施工日志信息")
        .AddInput("日期","日&emsp;&emsp;期","date").Value = dr("日期")


--  作者:cd_tdh
--  发布时间:2022/4/21 17:14:00
--  
在请教一下老师,在点击筛选前,怎么判断开始日期,结束日期必须输入值?
--  作者:有点蓝
--  发布时间:2022/4/21 17:16:00
--  
方法1、http://www.foxtable.com/mobilehelp/topics/0083.htm
2、http://www.foxtable.com/mobilehelp/topics/0104.htm

--  作者:cd_tdh
--  发布时间:2022/4/22 8:54:00
--  

老师,用方法1写在Shigong_daily.htm页面里面不生效呢?,JS也核对了没错啊

Dim e As object = args(0)
Dim wb As New weui
If e.PostValues.Count = 0 Then
    wb.AddTopTips("","toptip1","开始日期,结束日期不能为空!")
    wb.AddForm("","form1","Shigong_daily_filter.htm").Attribute = "" \'调用editor函数
    With wb.AddInputGroup("form1","ipg1","数据筛选")   \'ParentID 父容器的ID,如果是顶层对象,设置为""即可. ID 分组ID. Text 可选参数,用于指定分组标题.
        .AddInput("startdate","开始日期","date")
        .AddInput("enddate","结束日期","date")
    End With
    With wb.AddButtonGroup("form1","btg1",False)
        .Add("btn1", "首页", "", "default.htm")
        .Add("btn2", "筛选", "submit")
        .Add("btn3", "新增", "", "Shigong_daily_add.htm")
    End With
    wb.AppendHTML("<script src=\'./lib/editor.js\'></script>")   \'引入editor脚本文件
    e.WriteString(wb.Build)
Else
    Dim sb As New StringBuilder
    sb.AppendLine("<meta name=\'viewport\' c>")
    For Each key As String In e.PostValues.Keys
        sb.AppendLine(key & ":" & e.PostValues(key) & "</br>")
    Next
    e.WriteString(sb.ToString)
End If


--  作者:有点蓝
--  发布时间:2022/4/22 9:09:00
--  
js在哪?
--  作者:cd_tdh
--  发布时间:2022/4/22 9:16:00
--  

发现问题了,JS的文件名改了,JS里面的函数文件名没改到