Announcement

Collapse
No announcement yet.

Generating a GroupMail Subscription email from Order01

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Generating a GroupMail Subscription email from Order01

    We've just got to grips with GroupMail for managing our mailing list. Among other things, we've changed INVOICEUSERDEFINED to a checkbox as per the AUG, to be used as an indicator as to whether a purchaser wants to subscribe to the email list.

    I'd like to make the subscription process automatic from the order process, rather than having to export email addresses manually. GroupMail receives subscription requests via email, so the obvious way to automate it seems to be to get the website to send a subscription email when someone hits (or mouseover's) the 'next' button on order01, if the checkbox is checked. My thinking is
    (a) javascript triggered by onclick or onmouseover from the 'next button, which does the 'if' check on the checkbox;
    (b) a hidden form containing the email address submitted by Javascript, using FORMMAIL to generate the email.

    Problems:
    i) how do I get INVOICEEMAIL into the hidden form and INVOICEUSERDEFINED into the javascript
    ii) is there anything I should know about putting onclick or onmouseover on the 'NEXTBUTTON' in Order01?
    iii) is there anything I should know about the form names, etc on Order01 - it's very difficult to get any idea of the structure from the template!

    First attempt stopped the next button working at all, so any pointers (or suggestions on a neater solution) gratefully received!!

    Thanks,

    Neil
    Neil Rabbitts
    Out of the Hat Ltd

    www.outofthehat.co.uk - personalised gifts and more

    #2
    Hi, I'm not sure how GroupMail works, so can't comment on your strategy but it sounds workable. One immediate problem i can see is that you'll have to submit your new hidden form to a new window so that Actinic can carry on its own processes. You could do this in a pop-up, or to be extra sneaky you can use javascript to create a temporary invisible frame, and submit the form in the frame.

    To avoid the mess of templates and make sure you don't nest any forms, create a new form at the bottom of the primary template and call it something unique. The 'formpage.htm' should be replaced with the page GroupMail uses to process subscriptions.

    Code:
    <form name="groupMailForm" method="formpage.htm" action="post" target="tempFrame">
    <input type="hidden" name="groupMailAddress" />
    </form>
    Next, add an ID to your INVOICEUSERDEFINED checkox and INVOICEEMAIL input box for the Javascript to pick up easily, something like:

    Code:
    <input type="checkbox" name="INVOICEUSERDEFINED" id="INVOICEUSERDEFINED" />
    <input type="TEXT" id="INVOICEEMAIL" name="INVOICEEMAIL" size="20" maxlength="255" value="NETQUOTEVAR:INVOICEEMAIL">
    Now you need to create the Javascript function to check if the box is checked, copy the address to your hidden form, and then create the frame.

    Code:
    <script type="text/javascript">
    function groupMail(){
    if (!document.getElementById("INVOICEUSERDEFINED").checked){
      return false;
      }
    document.groupMailForm.groupMailAddress.value=document.getElementById("INVOICEEMAIL").value;
    tempFrame=document.createElement("iframe");
    tempFrame.style.display="none";
    tempFrame.name="tempFrame";
    document.body.appendChild(tempFrame);
    document.groupMailForm.submit();
    }
    </script>
    Finally, you need to add the onclick event handler to the next button. I would definately not use onmouseover since some users might have the checkbox selected by mistake, but move the mouse around and trigger the submission without meaning to.

    Try the above out and let me know how you get on

    - Graham
    Last edited by Kermy; 16-Nov-2005, 03:25 PM. Reason: correction
    www.gbradley.co.uk
    Web Development, Actinic Patches, Scripts & more

    Comment


      #3
      I just thought of a possible problem with this.

      If a user inputs something incorrectly (as they often do) then the order page is going to reload with relevant error messages. The groupMail submission will be sent again, and this will go on until the user enters everything correctly.

      I would assume GroupMail would check for duplicates before creating a subscription but it might still reply to the address saying the email address is already registered. The code could be added more to avoid this but just bear it in mind.
      www.gbradley.co.uk
      Web Development, Actinic Patches, Scripts & more

      Comment


        #4
        Thanks Graham, that's very helpful - plenty to get my teeth into.

        Originally posted by Kermy
        One immediate problem i can see is that you'll have to submit your new hidden form to a new window so that Actinic can carry on its own processes.
        The 'Actinic processes' are the bit I'm hazy about....

        One clarification before I try to break anything....

        Originally posted by Kermy
        The 'formpage.htm' should be replaced with the page GroupMail uses to process subscriptions.
        Groupmail checks a POP3 mailbox for subscription requests, so all we need is an email sent to that mailbox - I've used formmail elsewhere for this purpose (e.g. subscribe box on catalog pages). Given that, are frames necessary, as I could just use
        Code:
        <form action="http://www.outofthehat.co.uk/formmail/formmail.cgi" method="post">
        to generate an email - with the relevant hidden form fields, of course ...or will that interfere with Actinic's processes? Do I still need to do that in the hidden frame...? This paragraph is the only bit I'm not really clear on now...!


        -----------------------------------------------------
        Thanks for the javascript detail - very helpful. Also useful to know that adding ID's to the input boxes and onclick to the next button doesn't do any harm....
        Originally posted by Kermy
        If a user inputs something incorrectly....the groupMail submission will be sent again, and this will go on until the user enters everything correctly.
        Yes, thought of that. Groupmail does indeed check for duplicates - I'll just have to phrase the 'already subscribed' message carefully! I think more sophisticated checks, and sending unsubscribe messages for an unchecked box is for another day!! (though mostly more-of-the-same once the 'subscribe' is in place, I'd have thought!)
        Neil Rabbitts
        Out of the Hat Ltd

        www.outofthehat.co.uk - personalised gifts and more

        Comment


          #5
          Groupmail checks a POP3 mailbox for subscription requests
          Okay, so you need to use formmail to send an email to the POP3 mailbox. But, at the same time, you need to make sure that Actinic can carry on loading up the next stage in the order process. If you leave the form as you wrote it:
          Code:
          <form action="http://www.outofthehat.co.uk/formmail/formmail.cgi" method="post">
          your user will be taken to the formmail page and away from the Actinic pages. Thats why you need to include the 'target' value that appears in the form code I wrote - this ensures the formmail page is loaded 'behind the scenes', leaving the user to finish checking out.
          www.gbradley.co.uk
          Web Development, Actinic Patches, Scripts & more

          Comment


            #6
            Ah - all is clear. Thanks Graham. I'll let you know how I get on!

            N
            Neil Rabbitts
            Out of the Hat Ltd

            www.outofthehat.co.uk - personalised gifts and more

            Comment

            Working...
            X