以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  编辑功能  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=147342)

--  作者:nxqtxwz
--  发布时间:2020/3/14 15:43:00
--  编辑功能

请老师给看看,我下面的代码是要对数据进行编辑,但进入页面后:

1、输入不了,输入框无反应。

2、点击确定按钮后无反应。

 

Dim e As RequestEventArgs = args(0)
Dim wb As New weui
Dim PageNumber As Integer = e.GetValues("page")
Dim PrimaryKey As Integer = e.GetValues("key")
Dim PageURL = "jdlkList.htm?page=" & PageNumber
If e.PostValues.Count = 0 Then \'生成编辑页面
    Dim dr As DataRow = DataTables("学生数").SQLFind("[_Identify]=" & PrimaryKey)
    If dr IsNot Nothing Then
        wb.AddForm("","form1","edit.htm?key=" & PrimaryKey &  "&page=" & PageNumber)
        With wb.AddInputGroup("form1","ipg1","编辑学生信息")
           
            With .AddInput("年级","年级","text")
                .Value = dr("年级")
                .Readonly= True
            End With
           
            With .AddInput("班级","班级","text")
                .Value = dr("班级")
                .Readonly= True
            End With
           
            With .AddInput("班主任","班主任","text")
                .Value = dr("班主任")
                .Readonly= True
            End With
           
           
            With .AddInput("年报人数","年报人数","number")
                .Value = dr("年报人数")
                .Min = "25"
                .Max = "60"
                .Value = dr("年报人数")
                .Readonly= True
            End With
            With .AddInput("在校人数","在校人数","number")
                .Min = "25"
                .Max = "60"
                .Value = dr("在校人数")
                .Readonly= True
            End With
            With .AddInput("民族_汉族","汉族人数","number")
                .Min = "1"
                .Max = "50"
                .Value = dr("民族_汉族")
                .Readonly= True
               
            End With
            With .AddInput("民族_少数民族","少数民族","number")
                .Min = "1"
                .Max = "50"
                .Value = dr("民族_少数民族")
                .Readonly= True
               
            End With
            With .AddInput("性别_男","男生人数","number")
                .Min = "1"
                .Max = "50"
                .Value = dr("性别_男")
                .Readonly= True
            End With
           
            With .AddInput("性别_女","女生人数","number")
                .Min = "1"
                .Max = "50"
                .Value = dr("性别_女")
                .Readonly= True
            End With
            With .AddInput("住宿生_男","住宿男生数","number")
                .Min = "1"
                .Max = "50"
                .Value = dr("住宿生_男")
                .Readonly= True
            End With
            With .AddInput("住宿生_女","住宿女生数","number")
                .Min = "1"
                .Max = "50"
                .Value = dr("住宿生_女")
                .Readonly= True
            End With
           
        End With
       
       
        With wb.AddButtonGroup("form1","btg1",True)
            .Add("btn1", "确定", "submit")
        End With
    Else
        With wb.AddMsgPage("","msgpage","编辑失败", "此信息可能已经被删除!") \'提示
            .icon= "Warn"
            .AddButton("btn1","返回",PageURL) \'生成返回原来页面的按钮
        End With
    End If
Else \'保存编辑结果
    Dim dr As DataRow = DataTables("学生数").SQLFind("[_Identify]=" & PrimaryKey)
    If dr IsNot Nothing Then
        Dim nms() As String = {"学生数","年级","班级","班主任","年报人数","在校人数","民族_汉族","民族_少数民族","性别_男","性别_女","住宿生_男","住宿生_女"}
        For Each nm As String In nms
            dr(nm) = e.PostValues(nm)
        Next
        dr.Save()
        \'显示完成提示,2妙手自动返回原来的页面
        wb.AppendHtml("<meta http-equiv=\'refresh\' c>",True)
        wb.AddToast("","t1", "编辑完成",0).Visible = True
    Else
        With wb.AddMsgPage("","msgpage","保存失败", "此信息可能已经被删除!") \'提示.
            .icon= "Warn"
            .AddButton("btn1","返回",PageURL) \'生成返回原来页面的按钮
        End With
    End If
End If
e.WriteString(wb.Build) \'生成网页


--  作者:有点蓝
--  发布时间:2020/3/14 15:50:00
--  
都设置为只读了,当然不能编辑,把.Readonly= True全部去掉

后台跟踪能不能进入函数

Dim PageNumber As Integer = e.GetValues("page")
Dim PrimaryKey As Integer = e.GetValues("key")
msgbox(PrimaryKey )


--  作者:nxqtxwz
--  发布时间:2020/3/14 16:33:00
--  

实际已经进入了edit函数,并打开页面,也找到了要编辑的记录。只是点击确定按钮后就不动了。查看修改的信息没有写入数据表中。

[此贴子已经被作者于2020/3/14 16:40:04编辑过]

--  作者:有点蓝
--  发布时间:2020/3/14 16:56:00
--  
点击确定按钮后,后台跟踪能不能进入函数

Dim PageNumber As Integer = e.GetValues("page")
Dim PrimaryKey As Integer = e.GetValues("key")
msgbox(PrimaryKey )

--  作者:nxqtxwz
--  发布时间:2020/3/14 17:02:00
--  
以下是引用有点蓝在2020/3/14 16:56:00的发言:
点击确定按钮后,后台跟踪能不能进入函数

Dim PageNumber As Integer = e.GetValues("page")
Dim PrimaryKey As Integer = e.GetValues("key")
msgbox(PrimaryKey )
请问老师,怎么进行后台跟踪呢?我是编译后放到服务器上运行,拿手机连接试的,不知如何进行后台跟踪,请老师指点,谢谢,
--  作者:有点蓝
--  发布时间:2020/3/14 17:15:00
--  
到服务器看msgbox(PrimaryKey )提示框能不能弹出


--  作者:nxqtxwz
--  发布时间:2020/3/14 18:53:00
--  
以下是引用有点蓝在2020/3/14 17:15:00的发言:
到服务器看msgbox(PrimaryKey )提示框能不能弹出

老师好,可以弹出提示框,显示的是数字。下一步怎么办呢?


--  作者:狐狸爸爸
--  发布时间:2020/3/15 8:13:00
--  

.....
Else \'保存编辑结果
    MessageBox.Show("我执行了")
    Dim dr As DataRow = DataTables("学生数").SQLFind("[_Identify]=" & PrimaryKey)
    If dr IsNot Nothing Then
        Dim nms() As String = {"学生数","年级","班级","班主任","年报人数","在校人数","民族_汉族","民族_少数民族","性别_男","性别_女","住宿生_男","住宿生_女"}
        For Each nm As String In nms
            dr(nm) = e.PostValues(nm)
        Next
        dr.Save()
        \'显示完成提示,2妙手自动返回原来的页面
        wb.AppendHtml("<meta http-equiv=\'refresh\' c>",True)
        wb.AddToast("","t1", "编辑完成",0).Visible = True
    Else
        With wb.AddMsgPage("","msgpage","保存失败", "此信息可能已经被删除!") \'提示.
            .icon= "Warn"
            .AddButton("btn1","返回",PageURL) \'生成返回原来页面的按钮
        End With
    End If
    MessageBox.show("我生成的页面内容:" & wb.Build)
End If
e.WriteString(wb.Build) \'生成网页