Foxtable(狐表)用户栏目专家坐堂 → 手机网页报错:Cannot read property 'value' of null


  共有2526人关注过本帖树形打印复制链接

主题:手机网页报错:Cannot read property 'value' of null

帅哥哟,离线,有人找我吗?
benben325
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:164 积分:1487 威望:0 精华:0 注册:2021/8/9 16:05:00
手机网页报错:Cannot read property 'value' of null  发帖心情 Post By:2021/8/9 16:11:00 [只看该作者]

rt,用weui写的移动端页面如下:

图片点击可在新窗口打开查看此主题相关图片如下:qq截图20210809160817.jpg
图片点击可在新窗口打开查看
点击查询可以查询可以显示 查询结果。

狐表中关键代码如下:
With wb.AddInputGroup("page1",Functions.Execute("CreateId"))
    With .AddInputCell("inputBtn") '通过InputCell增加输入框
        With .AddInput("chaxunIntput","text",1) '增加输入框,1表示显示在中间
            If filter > "" Then
                .Value = filter
            End If
        End With
        .AddVcodeButton("vcodeBtn","查询",2).Attribute=" & pgname & "',1)"""
    End With
End With

js代码如下:
function showFilterList(pgname,ye) {
    var vcodeBtn = document.getElementById("vcodeBtn");
var filter = document.getElementById("chaxunIntput").value;
if (!filter){
vcodeBtn.href = "List.htm?page=" + pgname + "&ye=" + ye + "&filter="+filter;
}else{
    vcodeBtn.href = "List.htm?page=" + pgname + "&ye=" + ye;
}
}

点击查询按钮后,控制台出现 :Cannot read property 'value' of null  
请问我该怎么改?

 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:107147 积分:544978 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2021/8/9 16:19:00 [只看该作者]

if (!filter){

改为

if (filter){

 回到顶部
帅哥哟,离线,有人找我吗?
benben325
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:164 积分:1487 威望:0 精华:0 注册:2021/8/9 16:05:00
  发帖心情 Post By:2021/8/9 16:30:00 [只看该作者]

这里的确有点问题,但不是关键问题。我将js后面代码注释掉,改为:
function showFilterList(pgname,ye) {
    var vcodeBtn = document.getElementById("vcodeBtn");
    var filter = document.getElementById("chaxunIntput").value;
alert(filter)
}
也会报错!

 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:107147 积分:544978 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2021/8/9 16:32:00 [只看该作者]

var filter = document.getElementById("chaxunintput").value;

增加文本输入框的语法为:

AddInput(ID, Label, type)

ID输入框ID,注意生成网页时,WeUI会自动将所有ID转换为小写,例如"Table1"或转换为"table1",今后不再重复提示,大家请自行留意。
Label在输入框左侧显示的标签内容
Type输入框类型,普通文本输入框设置为"text",密码输入框设置为"password"

 回到顶部