以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  移动开发端 如何实现判断AddInput不为空时,允许点击登录呢?  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=133146)

--  作者:李孝春
--  发布时间:2019/4/8 11:30:00
--  移动开发端 如何实现判断AddInput不为空时,允许点击登录呢?
移动开发端 如何实现判断AddInput不为空时,允许点击登录呢?


代码如下:

Select Case e.Path
    Case "logon.htm" \'登录页面
        
        wb.AddPageTitle("","pageheader","案件流程推送","由瓮安县人民检察院李孝春设计开发")
        If e.PostValues.ContainsKey("username") AndAlso e.PostValues.ContainsKey("password")  Then \'判断是否是验证失败后的重新登录
            wb.AddTopTips("","toptip1","用户名或密码错误!").msec = 2000 \'如果用户通过登录按钮访问,则给用户一个2秒的提示.
        End If
        wb.AddForm("","form1","logon.htm")
        With wb.AddInputGroup("form1","ipg1")
            .AddInput("username","户名","text")
            .AddInput("password","密码","password")
        End With
        With wb.AddButtonGroup("form1","btg1",True)
            .Add("btn1", "登录", "submit")
        End With
        With wb.AddPageFooter("","pf1","Copyright © 贵州省瓮安县人民检察院")
            \'.AddLink("底部链接","http://www.foxtable.com")
        End With
        e.WriteString(wb.Build)

--  作者:有点甜
--  发布时间:2019/4/8 12:25:00
--  

用js做一下校验吧,如

 

Select Case e.Path
    Case "test.htm", ""
        Dim wb As New WeUI
        wb.AddPageTitle("","pageheader","案件流程推送","由瓮安县人民检察院李孝春设计开发")
        If e.PostValues.ContainsKey("username") AndAlso e.PostValues.ContainsKey("password")  Then \'判断是否是验证失败后的重新登录
            wb.AddTopTips("","toptip1","用户名或密码错误!").msec = 2000 \'如果用户通过登录按钮访问,则给用户一个2秒的提示.
        End If
        wb.AddForm("","form1","logon.htm")
        With wb.AddInputGroup("form1","ipg1")
            .AddInput("username","户名","text")
            .AddInput("password","密码","password")
        End With
        With wb.AddButtonGroup("form1","btg1",True)
            .Add("btn1", "登录", "button").Attribute = "onclick=""if(username.value==\'\' || password.value==\'\'){alert(\'不能为空\');}else{alert(\'提交\'); form1.submit();}"""
        End With
        With wb.AddPageFooter("","pf1","Copyright © 贵州省瓮安县人民检察院")
            \'.AddLink("底部链接","http://www.foxtable.com")
        End With
        e.WriteString(wb.Build)
End Select