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 10 of 10
  1. #1
    New Coder
    Join Date
    Sep 2011
    Location
    Orange County, California
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Need code for a checked box

    Hello!

    Thanks in advance for your help.

    I want to begin with the box checked (Yes, I want to subscribe to magazine)

    1. The box is checked then go to email 1 (Thanks for subscribing)
    2. The box has been unchecked then go to email 2 (Perhaps you need more info)

    Pat

  • #2
    Senior Coder xelawho's Avatar
    Join Date
    Nov 2010
    Posts
    2,901
    Thanks
    56
    Thanked 543 Times in 540 Posts
    Code:
    <input type="checkbox" checked="checked" id="cbox" onclick="boxCheck()"/>
    
    function boxCheck () {
    if (document.getElementById("cbox").checked==true){
    //go to email 1 (Thanks for subscribing)
    } else {
    //go to email 2 (Perhaps you need more info)
    }
    but the function will not fire until someone checks or unchecks the box... unless you fire it automatically when the page loads (in which case why not send them straight to email 1?)

    a bit confused about the logic of it is all...

  • #3
    Regular Coder
    Join Date
    Apr 2005
    Location
    Texas
    Posts
    448
    Thanks
    24
    Thanked 63 Times in 63 Posts
    @xelawho I agree, a little confusing. I think that patcalgal wants the onsubmit to query the checked status of the box, then depending on that send all of the form data to one email or the other...
    Code:
    <script>
    function boxCheck () {
    if (document.getElementById("cbox").checked==true){
    //go to email 1 (Thanks for subscribing)
    } else {
    //go to email 2 (Perhaps you need more info)
    }
    </script>
    
    <form action="" method="post" onsubmit=boxCheck()>
    <input type="checkbox" checked="checked" id="cbox" />
    </form>

  • #4
    New Coder
    Join Date
    Sep 2011
    Location
    Orange County, California
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks for the code.

    I wanted them to have to uncheck the box.

    When it opens it would be checked.

    That is logical, isn't it? Marketing uses that all the time with the free sample that you have to call to stop or they start billing your credit card.

    Before this there is an form for them to optin. I am placing this check box after they fill out the form and before they submit.

    Pat

  • #5
    Regular Coder
    Join Date
    Apr 2005
    Location
    Texas
    Posts
    448
    Thanks
    24
    Thanked 63 Times in 63 Posts
    @patcalgal both examples provided by xelawho and myself satisfy those requirements with the checked = "checked" bit. The only difference is that xelawho made the assumption that you wanted to send the email when the user clicked the checkbox; which confused him because if it started checked, then the user might never click it! Whereas I assumed that you wanted to ask the box if it was checked when you submitted your form, but that you omitted that from your post by mistake. I made that assumption because it is indeed logical, and yes:
    Marketing uses that all the time with the free sample that you have to call to stop or they start billing your credit card.

  • #6
    Senior Coder xelawho's Avatar
    Join Date
    Nov 2010
    Posts
    2,901
    Thanks
    56
    Thanked 543 Times in 540 Posts
    it's true, blaze4218 - when it comes to sneaky marketing tactics I doff my cap to you, sir

  • #7
    New Coder
    Join Date
    Sep 2011
    Location
    Orange County, California
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks for taking the time to help me.

    I am giving it a try today.

    Any hints on putting in the links to Aweber (Email 1) and Email (2)

    Pat

  • #8
    Regular Coder
    Join Date
    Apr 2005
    Location
    Texas
    Posts
    448
    Thanks
    24
    Thanked 63 Times in 63 Posts
    @xelawho lol, not fair, I was quoting her. Besides, that's on like every online service I sign up for... I always have to keep an eye out for it...
    @patcalgal huh? Are you using a simple
    <a href="mailto:someone@example.com?Subject=Hello%20again">Send Mail</a>
    or some kind of serverside script? Or something else entirely?

  • #9
    New Coder
    Join Date
    Sep 2011
    Location
    Orange County, California
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I am sending it to aweber for the email message.

    There will be list 1 decided and list 2 undecided.

    In the script for the optin form, I will have to place a link to the proper list.

  • #10
    Senior Coder xelawho's Avatar
    Join Date
    Nov 2010
    Posts
    2,901
    Thanks
    56
    Thanked 543 Times in 540 Posts
    Quote Originally Posted by blaze4218
    @xelawho lol, not fair, I was quoting her.
    yeah, that's what all you marketing guys say


  •  

    Posting Permissions

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