Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Feb 2003
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Sending Email upon exiting a form

    My client wants to be able to email customers when they exit a form, asking them why they didn't complete it. Is this even possible in ASP? Can I use the session_onend function in the global.asa file to do this?

  • #2
    Regular Coder
    Join Date
    Sep 2002
    Location
    UK
    Posts
    102
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You could use Javascript to open a page that fires off an email when they close that window, how would you get their address though?

  • #3
    Senior Coder
    Join Date
    Jun 2002
    Location
    41° 8' 52" N -95° 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Nick?
    Last edited by whammy; 02-17-2003 at 12:36 AM.
    Former ASP Forum Moderator - I'm back!

    If you can teach yourself how to learn, you can learn anything. ;)

  • #4
    New to the CF scene
    Join Date
    Feb 2003
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I have their email address after they complete the first page of the form. I want to be able to shoot that person an email if they close their browser after the first page of the form. The form has four pages. How would I use javascript then? Use OnBeforeUnload in the body tag to call another asp page using javascript, that would generate the email? What would that code look like then in the body tag? This is Nick, Rob.

  • #5
    Senior Coder
    Join Date
    Jun 2002
    Location
    41° 8' 52" N -95° 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Ok... I got this to work... however, I still don't know how to tell whether they clicked "cancel" or "ok", since you have to return that stupid string to OnBeforeUnload.

    I'm thinking maybe stick their "UserID" (you know what I mean) in the url and throw it in a database... then have some DTS package or some script that runs and emails everyone (by distinct email address) in the database that hasn't finished the form, and is older than, say, 20 minutes? We'd have to do some testing on that, but it might work... of course changing some bit field in the database when the script or whatever executes so they don't get emailed again.

    If you generated an email every time this function was called, it would tick some people off...

    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
       "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
       <head>
          <title>UnUnloadTest</title>
    <script type="text/javascript">
    <!--
    function changeImage() {
       t = new Date()
       time = t.getTime();
       document.images['myimage'].src = "http://rob/birthdate.asp?blah=" + t;
       return "I don't like proprietary technology on websites!";
    }
    // -->
    </script>
       </head>
       <body onBeforeUnload="return changeImage()">
          <div>
             <img src="w3c_xhtml.gif" id="myimage" width="1" height="1" alt="" />
          </div>
       </body>
    </html>
    Last edited by whammy; 02-17-2003 at 01:03 AM.
    Former ASP Forum Moderator - I'm back!

    If you can teach yourself how to learn, you can learn anything. ;)

  • #6
    Senior Coder
    Join Date
    Jun 2002
    Location
    41° 8' 52" N -95° 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts
    This all comes back to doing it with a database, for every possible scenario I can imagine, since they could fire the onBeforeUnload event a couple of times, perhaps, and then complete the form. Even if we got the global.asa idea working, it might not be as easy as this idea, though...:

    Send an email the VERY first time the onBeforeUnload event is triggered, and then have your ASP script check to see if you've already emailed them, so you don't send another email. Of course if it's done that way, you'd better have a nice apology in the original email like:

    "If you completed the form after all, please disregard this email, and accept our sincerest apologies for making you mad at us twice."

    Probably the easiest solution, anyway... they might go for that with the right wording. Of course they'd need to put in another disclaimer as well, stating "you will not receive any further email from *** unless you have opted to receive etc. etc. etc. blah blah blah"... otherwise they will add another set of angry (potential?) customers in addition to the ones they already have.

    Of course, this may be a very good thing, since from my experience most of the angry customers they have were angry about the number and type of questions they had to answer for the ***********. So if they change their forms using this kind of feedback, it might be better in the long run.

    I'll tell you more about it tomorrow, hehe.



    P.S. For anyone wondering if I'm psychic, yeah... I am. LOL
    Last edited by whammy; 02-17-2003 at 01:24 AM.
    Former ASP Forum Moderator - I'm back!

    If you can teach yourself how to learn, you can learn anything. ;)


  •  

    Posting Permissions

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