Rss & SiteMap

Foxtable(狐表) http://www.foxtable.com

新一代数据库软件,完美融合Access、Foxpro、Excel、vb.net之优势,人人都能掌握的快速软件开发工具!
共8 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:移动开放,日期输入框怎么用代码赋值,选中日期后怎么直接触发

1楼
zhchling 发表于:2025/1/9 22:11:00
移动高级开发指南里,使用表格,数据筛选与分页,  

 .AddInput("startdate","开始日期","date")  日期输入框,点击确定后, 日期框内是空的,不能显示日期, 


问题1.  选好日期,点击确定,怎么能让日期框里保留日期值。

问题2. 怎么用代码给这个日期输入框赋值?  尤其是在其他页面部分(case list.htm) 里面给这个日期输入框赋值,

问题3. 怎么能日期发生变化后,就进入list.htm的代码, 节省掉提交点击那个“确定”按钮



Dim
wb As New WeUI
Select
Case e.Path
    Case "filter.htm"
        wb.AddForm("","form1","list.htm")
        With wb.AddInputGroup("form1","ipg1","
数据筛选")
            .AddSelect("product","
产品","|PD01|PD02|PD03|PD04|PD05")
            .AddInput("startdate","
开始日期","date")
            .AddInput("enddate","
结束时间","date")
        End With
        With wb.AddButtonGroup("form1","btg1",True)
            .Add("btn1", "
确定", "submit")
        End With
    Case "list.htm"
2楼
有点蓝 发表于:2025/1/9 23:02:00
1、我测试没有问题,是不是没有选中日期

2、参考:http://www.foxtable.com/mobilehelp/topics/0046.htm,看后面第二段代码

3、到onchanged事件处理,类似:http://www.foxtable.com/mobilehelp/topics/0103.htm
3楼
zhchling 发表于:2025/1/10 9:59:00
问题2.  实际上就是在其他页面怎么引用日期输入框, 用什么语法?


怎么引用   test.htm 的  form1 的 wb.AddInputGroup  的日期输入框 .AddInput("xm"     





Select
Case e.Path
    Case "test.htm"
        Dim wb As New weui
        wb.AddForm("","form1","test.htm")
        With wb.AddInputGroup("form1","ipg1",
"
时间输入")
            .AddInput("xm",
"
日期","date").Value = Format(Date.Today,"yyyy-MM-dd")
            With .AddInput("xm",
"
时间","time")
                .value = Format(Date.Now,"HH:mm")
               
.Min = "08:00" '输入的事件必须在8:00到12:00之间
                .Max = "12:00"               
            End With
            With .AddInput("xm","日期时间","datetime-local")
                .Value = Format(Date.Now,"yyyy-MM-ddTHH:mm") '留意一下这个格式,日期和时间之间用字母T隔开
               
.Readonly = True
            End With
        End With
        With wb.AddButtonGroup("form1","btg1",True)
            .Add("btn1",
"
确定", "submit")
        End With
       
e.WriteString(wb.Build) '生成网页
End
Select
4楼
有点蓝 发表于:2025/1/10 10:10:00
提交,参考:http://www.foxtable.com/mobilehelp/topics/0113.htm
5楼
zhchling 发表于:2025/1/10 10:24:00
没有理解我的需求, 不是提交,

我在btn1点击提交后,执行today.htm, 需要把 日期输入框 .AddInput("startdate" 的日期值, 显示为date.today
我不会写这个语法, 怎么用代码把日期输入框的vlaue赋值 


Dim wb5 As New WeUI
wb5.AddForm("", "form1", "list.htm")
With wb5.AddButtonGroup("form1", "btg2", False) '水平排列
    .Add("btn1", "今日", "button", "today.htm")
    .Add("btn2", "明日", "button", "tomorrow.htm")
    .Add("btn3", "<", "submit").FormAction = "list.htm?btn=3" 
    .Add("btn4", ">", "button", "submit").Value = "btn4" 
End With

'wb5.AddForm("", "form2", "list.htm")
With wb5.AddInputGroup("form1", "ipg1", "数据筛选")
    .AddInput("startdate", "日期", "date").Value = e.PostValues("startdate")
End With
With wb5.AddButtonGroup("form1", "btg3", False) '水平排列
    .Add("btn4", "确定", "submit") 
End With

Select Case e.Path 
    Case "today.htm"
        

  ‘下面这句代码,是要把日期输入框赋值显示日期,怎么写语法?  ’      
怎么表述日期输入框。

 wb5.AddInputGroup.AddInput("form1", "startdate").Value = date.today
  
       
[此贴子已经被作者于2025/1/10 10:43:04编辑过]
6楼
有点蓝 发表于:2025/1/10 10:44:00
.Add("btn1", "今日", "button").Attribute = "onclick=""xxx函数()"""

js函数:http://www.foxtable.com/mobilehelp/topics/0018.htm

function xxx函数(){
  var now = new Date();
var year = now.getFullYear();
var month = ("0" + (now.getMonth() + 1)).slice(-2); // 月份从0开始,需加1
var day = ("0" + now.getDate()).slice(-2);
var today = year + "-" + month + "-" + day;
document.getElementById("startdate").value = today;
location="today.htm"
}

7楼
zhchling 发表于:2025/1/10 10:59:00
意思是说: 无法直接引用这个日期输入框?


非移动开发版,窗体里的控件,可以用 e.Form.Controls("DateTimePicker1")引用。  
移动开发里,无法用代码引用 “日期输入框“ 并 赋值?
[此贴子已经被作者于2025/1/10 11:04:26编辑过]
8楼
有点蓝 发表于:2025/1/10 11:08:00
网页是显示在用户的浏览器里的,而Foxtable代码是在后台服务器电脑里执行的。

直接改变网页控件值,只能在用户浏览器里执行js处理
共8 条记录, 每页显示 10 条, 页签: [1]

Copyright © 2000 - 2018 foxtable.com Tel: 4000-810-820 粤ICP备11091905号

Powered By Dvbbs Version 8.3.0
Processed in .05469 s, 2 queries.