给用户一个提示

如果表单包括文件上传组件Uploader,那么有必要在提交表单的过程中,给用户一个提示,避免用户失去耐心:

知识准备

用户单击确定按钮提交表单的时候,会触发表单的onsubmit事件,我们可以在这个事件中显示一个toast,提示用户正在上传文件,例如:

wb.AddForm("","form1","test.htm").attribute= "onsubmit=""show('t1')"""

表示定义了一个表单,提交这个表单的时候,会显示名为t1的toast,不仅可以给用户一个提示,还可以避免用户再次单击确定按钮,重复提交数据。

HttpRequest事件代码:

Select Case e.Path
    Case "test.htm"
        Dim wb As New weui
        wb.AddToast("","t1",
"
正在上传",1) '定义提示
        wb.AddForm("","form1","test.htm").attribute= "onsubmit=""show('t1')"""
        With wb.AddInputGroup("form1","ipg1",
"
客户资料")
            .AddInput(
"
姓名","姓名","Text").value = "舒淇"
            .AddInput(
"
年龄","年龄","number").Value = "28"
            .AddInput(
"
日期","日期","date").value = #10/12/2012#
            With .AddUploader("up1",
"
照片",True)
                .AddImage("./images/shuqi1.jpg")
                .AddImage("./images/shuqi2.jpg")
            End With
        End With
        With wb.AddButtonGroup("form1","btg1",True)
            .Add("btn1",
"
确定", "submit")
        End With
       
e.WriteString(wb.Build) '生成网页
End Select

 

 

 


本页地址:http://www.foxtable.com/mobilehelp/topics/0105.htm