...

View Full Version : Need code for a checked box



patcalgal
09-21-2011, 04:53 PM
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

xelawho
09-21-2011, 05:02 PM
<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... :confused:

blaze4218
09-21-2011, 05:12 PM
@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...


<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>

patcalgal
09-21-2011, 06:07 PM
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

blaze4218
09-21-2011, 07:08 PM
@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.

xelawho
09-21-2011, 08:00 PM
it's true, blaze4218 - when it comes to sneaky marketing tactics I doff my cap to you, sir ;)

patcalgal
09-21-2011, 08:13 PM
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

blaze4218
09-21-2011, 08:22 PM
@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?

patcalgal
09-21-2011, 08:34 PM
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.

xelawho
09-21-2011, 09:01 PM
@xelawho lol, not fair, I was quoting her.

yeah, that's what all you marketing guys say :p



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum