以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  调用的目标发生了异常。  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=125293)

--  作者:刘林
--  发布时间:2018/9/25 17:15:00
--  调用的目标发生了异常。
Dim e As RequestEventArgs = args(0)
Dim wb As New  weui
Dim dr As DataRow = DataTables("用户").sqlfind("身份证号=\'" & e.Cookies("username") & "\'")
wb.InsertHTML("<!DOCTYPE html>")
wb.InsertHTML("<html>")
wb.InsertHTML("<head>")
wb.InsertHTML("<meta charset=\'utf-8\'>")
wb.InsertHTML("<meta name=\'viewport\' c />")
wb.InsertHTML("<title></title>")
wb.InsertHTML("<script src=\'../mui/js/mui.min.js\'></script>")
wb.InsertHTML("<link href=\'../mui/css/mui.css\' rel=\'stylesheet\'/>")
wb.InsertHTML("<script Type=\'text/javascript\' charset=\'utf-8\'>mui.init();</script>")
wb.InsertHTML("</head>")
wb.InsertHTML("<body>")
wb.InsertHTML("<header class=\'mui-bar mui-bar-nav mui-bar-nav-bg\'>")
wb.InsertHTML("<a  id=\'icon-menu\' class=\'mui-action-back mui-icon mui-icon-left-nav mui-pull-left\'></a>")
wb.InsertHTML("<h1 class=\'mui-title\'>密码修改</h1>")
wb.InsertHTML("</header>")
wb.InsertHTML("<div class=\'mui-content\'>")
wb.InsertHTML("<br>")
If e.PostValues.Count = 0 Then
    wb.AddForm("","form1","xgmm.htm")
    With wb.AddInputGroup("form1","ipg1")
        Dim idfm = .AddInput("username","用户名:","text")
        idfm.value= e.Cookies("username")
        idfm.readonly = True
        Idfm.attribute="style= \'border:none;padding:0px;height:30px;width:auto;margin:0;"
        Dim idxm = .AddInput("username","姓&nbsp;&nbsp;&nbsp;&nbsp;名:","text")
        idxm.value= dr("name")
        idxm.attribute="style= \'border:none;padding:0px;height:30px;width:auto;margin:0;"
        idxm.readonly = True
        Dim ymm =.AddInput("ymm","原密码:","password")
        ymm.placeholder ="请输入原密码"
        ymm.attribute="style= \'border:none;padding:0px;height:30px;width:auto;margin:0;"
        Dim xmm =.AddInput("xmm","新密码:","password")
        xmm.placeholder ="请输入6位新密码"
        xmm.attribute="style= \'border:none;padding:0px;height:30px;width:auto;margin:0;"
        
    End With
    With wb.AddButtonGroup("form1","btg1",False)
        Dim bt1=  .Add("btn1", "确定修改", "submit")
        bt1.attribute="style=\'border:1px solid black;border-radius:40px;padding:0px;width:50%\'"
        bt1.kind=1
 
    End With
    e.WriteString(wb.Build)
Else
    If e.PostValues("ymm")<> e.Cookies("password")
        With wb.AddMsgPage("","msgpage","修改不成功", "原密码不正确!")
            .icon = "Warn" \'改变图标
            Dim bt1 =.AddButton("btn1","返回")
            bt1.Attribute = " style=\'border:1px solid black;border-radius:20px;padding:0px;width:50%\'"
            bt1.kind=1
        End With
        e.WriteString(wb.Build)
        Return ""
    End If
    If  e.PostValues("xmm").length<>6
        With wb.AddMsgPage("","msgpage","修改不成功", "新密码统一要求应为六位")
            .icon = "Warn" \'改变图标
            Dim bt1= .AddButton("btn1","返回")
            bt1.Attribute = " style=\'border:1px solid black;border-radius:20px;padding:0px;width:50%\'"
            bt1.kind=1
        End With
        e.WriteString(wb.Build)
        Return ""
    End If
    dr("password")=e.PostValues("xmm")
    wb.AppendCookie("password",e.postvalues("xmm"))
    dr.save()
    With wb.AddMsgPage("","msgpage","密码改成为", "请记住你修改的新密码为:" & e.postvalues("xmm")) \'生成成功提示页
        Dim bt6= .AddButton("btn6","返回","javascript:history.back()")
        bt6.Attribute = "style=\'border:1px solid black;border-radius:20px;padding:0px;width:50%\'"
        bt6.kind=1
    End With
    
End If
wb.InsertHTML("form1","</div>")
wb.InsertHTML("<script src=\'../mui/js/mui.min.js\'></script>")
wb.InsertHTML("<link href=\'../mui/css/mui.css\' rel=\'stylesheet\'/>")
wb.InsertHTML("<script Type=\'text/javascript\' charset=\'utf-8\'>mui.init();</script>")
e.WriteString(wb.Build)


老师,上面红色部分判断若ymm的宽度不为6,则返回,当没输入xmm时提示调用的目标发生了异常。怎么改?

--  作者:有点甜
--  发布时间:2018/9/25 17:48:00
--  

If  e.PostValues("xmm").length<>6

 

改成

 

If e.PostValues("xmm") = Nothing OrElse e.PostValues("xmm").length<>6 Then


--  作者:刘林
--  发布时间:2018/9/25 18:45:00
--  
哦,可以了,谢谢