Results 1 to 14 of 14

Thread: trapping a submit

  1. #1
    Join Date
    Feb 2003
    Posts
    62

    trapping a submit

    Hi

    I know I can use Get_LastClick to trap a submit but how can I do the equivalent of the following to create a msgbox?

    btnSendLive.Attributes.Add"onclick", "javascript:return confirm('Are you sure you want to send out all the emails in Essential Skills Collection table?');")

    Thanks

    Bob

  2. #2
    Join Date
    Oct 2002
    Posts
    933
    This one requires a JS guru and is beyond me. Seems like once the popup, the Form info might be lost.

    I think the popular way to do this is to display a confirmation form like an order confirmation and then ask user to click the confirm button. This would avoid popup blockers also. The conformation for is another aspx or the same aspx with a different entry parameter (program.aspx?Choice=2). It also can be a popup.

    Frank

  3. #3
    Join Date
    Feb 2003
    Posts
    62
    ok - I just thought there may be a way of using the button generated by Tornado.

    Bob

  4. #4
    Join Date
    Oct 2002
    Posts
    933
    Let us know if you find a fancy way to do it.

    FK

  5. #5
    Join Date
    Oct 2002
    Posts
    32
    Bob,
    If I understand you correctly, this is simple. Use the EditValidateName parameter in your Mydb.dbEditParams statement and put this code in your validation function:

    <SCRIPT LANGUAGE="JavaScript">
    function EditValidate() {
    answer = confirm("U sure?");
    if (answer == "true") {
    return true; // accept the submit
    }else{
    return false; // go back to the form
    }
    }
    </SCRIPT>

    I hope that helps.
    -Mark

  6. #6
    Join Date
    Feb 2003
    Posts
    62
    Mark

    I am looking for the example to show me how to use editvalidatename. The link to the example is:

    http://www.aspdb.com/Site/tor/eg_EditUpdate.aspx

    but it comes up with an error msg: can't find the resource.

    Bob

  7. #7
    Join Date
    Feb 2003
    Posts
    62
    ok - the example is working again but I am not sure how to incorporate the function you supplied with the dbEditParams property. Can you help?

    Thanks

  8. #8
    Join Date
    Oct 2002
    Posts
    32
    Bob,

    x.dbEditParams = "TableName=Email,BookMarkFlds=0,TableTag=Border=2, EditValidateName=EditValidate()"

    See Programming Example 105 at:
    http://www.aspdbtest.com/examples/ViewPro/

    -Mark

  9. #9
    Join Date
    Feb 2003
    Posts
    62
    Mark

    I have found a sample and incorporated it into a test page but I can't get it working - here it is:

    <%@page language = "vb" %>
    <script runat="server">

    Sub Page_Load(Source as Object, E as EventArgs)
    Dim strSQL as string = "Select * From customers where customerID = 'FRANK'"
    DisplayGrid(strSQL)
    End Sub

    sub DisplayGrid(strSelect as string)
    Dim EditAll As New tornado.z
    With EditAll
    .dbUnit = 777
    .dbSkin = 12
    .dbMode = "grid"
    .dbQP="eaf=EditValidate()"
    .dbtype = "sql"
    .dbCulture="en-GB"
    .dbBookmark="customers;0"
    .dbEditAddFlds = "0,1,2"
    .dbPageSize=15
    .dbDSN=application("nwindsql")
    .dbSQL = strSelect
    .dbNavigationItem = "add,update"
    .dbstatusbar="true"
    .dbGridDisplayFlds = "1,2,3,4"
    .ASPdbNET()
    end with
    end sub


    </script>

    <body>
    <head>
    <SCRIPT LANGUAGE="JavaScript">
    function EditValidate() {
    answer = confirm("U sure?");
    if (answer == "true") {
    return true; // accept the submit
    }else{
    return false; // go back to the form
    }
    }
    </SCRIPT>
    </head>
    </body>

    Bob

  10. #10
    Join Date
    Oct 2002
    Posts
    32
    Bob,
    I don't think QuickProps supports EditValidate. Contact me directly. I have a working example.
    Thanks,
    Mark

  11. #11
    Join Date
    Oct 2002
    Posts
    933
    Try the following ->


    <HEAD>
    <SCRIPT LANGUAGE="JavaScript">
    function MyJS() {
    answer = confirm("U sure?");
    if (answer == "true") {
    return true; // accept the submit
    }else{
    return false; // go back to the form
    }
    }
    </SCRIPT>
    </HEAD>

    <script language='vb' runat='server'>
    Sub Page_Load(Source as Object, E as EventArgs)
    Dim JS As New tornado.z()
    With JS
    .dbQP = "U=1| D=NWIND| S=8| GDF=0,1,2,3| Ni=b5,update,add| euf=0,1,2| eaf=0,1,2| bm=customers;0| evn=MyJS()| TH=title=JS"
    .dbSQL = "Select * From customers where customerID = 'FRANK'"
    .ASPdbNET()
    End With
    End Sub
    </Script>

  12. #12
    Join Date
    Oct 2002
    Posts
    32
    Quick Props "evn"?
    Is that new?
    It's not documented anywhere, is it?
    -Mark

  13. #13
    Join Date
    Oct 2002
    Posts
    933
    No, it is not new. Actually I have to look it up to confirm.... editvalidatename should be EVN.

    This app is very interesting.. I'll have to post that after it all works...

    Frank

  14. #14
    Join Date
    Oct 2002
    Posts
    933
    This Edit Confirm example is added to the "Edit" Manual page.

    Frank

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •