View Full Version : Stuck on this Checkbox Code

10-07-2011, 12:24 AM
This code is designed to send people either to List 1 or List 2 in the Aweber form.

At this time, I cannot make the uncheck go to List 2 to receive that thankyou email. Can you tell me what is wrong???

Check--Yes I would like to subscribe--List 1 email--thank you
uncheck--No, I do not want to subscribe--List 2--you need more information

I am omitting the top of the Aweber code before <body>--

<script language="javascript">

function magCheck(){
var magcheckbox = document.MainForm.magcheckbox.checked;

if(magcheckbox == true){
document.getElementById("keylivingwell").value = '1355523361'
document.getElementById("redirect").value = 'http://www.aweber.com/thankyou-coi.htm?m=text';

}else if(magcheckbox == false){
document.getElementById("keylivingwund").value = '1357528764'
document.getElementById("redirect").value = 'http://www.aweber.com/thankyou-coi.htm?m=text';


<form method="post" class="af-form-wrapper" action="http://www.aweber.com/scripts/addlead.pl" >
<div style="display: none;">
<input type="hidden" id="meta_web_form_id" name="meta_web_form_id" value="1355523361" />
<input type="hidden" name="meta_split_id" value="" />
<input type="hidden" name="listname" value="keylivingwell" />
<input type="hidden" name="redirect" value="http://www.aweber.com/thankyou-coi.htm?m=text"

id="redirect_77879d6b0d1bc03d212e86d72e1eae3c" />

<input type="hidden" name="meta_adtracking" value="Key_to_Living_Well_in_Retirement" />
<input type="hidden" name="meta_message" value="1" />
<input type="hidden" name="meta_required" value="name,email" />

<input type="hidden" name="meta_tooltip" value="" />
<div id="af-form-1355523361" class="af-form"><div id="af-header-1355523361" class="af-header"><div

class="bodyText"><p>&nbsp; &nbsp; &nbsp;Yes, thank you, I would like</p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; a copy of the Report!</p></div></div>
<div id="af-body-1355523361" class="af-body af-standards">
<div class="af-element">
<label class="previewLabel" for="awf_field-25981213">Name: </label>
<div class="af-textWrap">
<input id="awf_field-25981213" type="text" name="name" class="text" value="" tabindex="500" />
<div class="af-clear"></div></div>
<div class="af-element">
<label class="previewLabel" for="awf_field-25981214">Email: </label>
<div class="af-textWrap"><input class="text" id="awf_field-25981214" type="text" name="email" value="" tabindex="501"

</div><div class="af-clear"></div>
<div class="af-element buttonContainer">
<input name="submit" id="af-submit-image-1355523361" type="image" class="image" style="background: none;"

alt="Submit Form" src="http://www.aweber.com/images/forms/modern/blue/button.png" tabindex="502" />
<div class="af-clear"></div>
<div class="af-element privacyPolicy" style="text-align: center"><p><a title="Privacy Policy"

href="http://www.aweber.com/permission.htm" target="_blank">We respect your email privacy</a></p>
<div class="af-clear"></div>
<div class="af-element poweredBy" style="text-align: center; font-size: 9px;"><p>Powered by <a

href="http://www.aweber.com" title="Email Marketing Services">AWeber</a> <a href="http://www.aweber.com"

title="Email Marketing Services">Email Marketing Services</a></p>
<div class="af-clear"></div>
<div id="af-footer-1355523361" class="af-footer"><input id="magcheckbox" name="magcheckbox" onclick="magCheck();"

type="checkbox" value="1" checked> <div class="bodyText"><p><span style="font-size: 14px;">&nbsp; &nbsp; &nbsp;

&nbsp; &nbsp; Yes, I would like to subscribe</span></p>
<p><span style="font-size: 14px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;to Baby Boomers

<div style="display: none;"><img src="http://forms.aweber.com/form/displays.htm?id=jMysrKxMzMxsjA==" alt=""

<script type="text/javascript">
(function() {
var IE = /*@cc_on!@*/false;
if (!IE) { return; }
if (document.compatMode && document.compatMode == 'BackCompat') {
if (document.getElementById("af-form-1355523361")) {
document.getElementById("af-form-1355523361").className = 'af-form af-quirksMode';
if (document.getElementById("af-body-1355523361")) {
document.getElementById("af-body-1355523361").className = "af-body inline af-quirksMode";
if (document.getElementById("af-header-1355523361")) {
document.getElementById("af-header-1355523361").className = "af-header af-quirksMode";
if (document.getElementById("af-footer-1355523361")) {
document.getElementById("af-footer-1355523361").className = "af-footer af-quirksMode";

I have looked at it so long time, I can't find it. Thanks for your help,


Logic Ali
10-07-2011, 12:41 AM
It would be easy to point to the error, but the error console must be doing it for you. Try using it.

10-07-2011, 01:07 AM
I have.

Right now--everyone subscribes.

Old Pedant
10-07-2011, 01:09 AM
Don't you mean the THREE errors, Logic?

At least three, anyway.

Old Pedant
10-07-2011, 01:12 AM
Logic means: Bring up the page in the browser. Uncheck the box. Look at the error message that the browser gives you.

If you don't know how to find where the error message shows up, it depends on what browser you are using. With MSIE, for example, it shows up as a little icon in the status bar you can check on.

With firefox, you click on the TOOLS menu and then on ERROR CONSOLE.

10-07-2011, 01:15 AM
Well, new eyes are not helping.

You are also confirming it isn't easy.


Old Pedant
10-07-2011, 01:17 AM
Oh, w.t.h.

(1) You don't give a name to your <form> so you can't use document.MainForm.
(2) There is no element in your page with an id of "keylivingwell". That's a *VALUE*, not an ID.
(3) There is no element in your page with an id of "keylivingwund". No idea what in the **** that's supposed to mean.
(4) There is no element in your page with an id of "redirect". That's a *NAME*, not an ID.


In any case, there's no point in mucking with "redirect", because you are trying to change it to the value it already has...no matter if the box is checked or not you give it the same value it has.

Old Pedant
10-07-2011, 01:19 AM
If I had a clue as to which form field is supposed to get those two possible numeric values of 1355523361 and 1357528764 I could maybe fix it, but I don't see any reasonable place to put those.

10-07-2011, 01:25 AM

I appreciate your input.

keylivingwell is name of list 1
keylivingwund is name of list 2 (und refers to undecided)

I have had other coders looking at it today.

What we have now is the result of their input.

Please excuse if I sound frustrated.

We do not get errors. It likes going to List 1.


10-07-2011, 01:39 AM
If I had a clue as to which form field is supposed to get those two possible numeric values of 1355523361 and 1357528764 I could maybe fix it, but I don't see any reasonable place to put those.

keylivingwell is List 1--value 1355523361

keylivingwund is List 2--value 1357528764

Thanks for your time and efforts.


Logic Ali
10-07-2011, 02:31 AM
Don't you mean the THREE errors, Logic?

At least three, anyway.I stopped at the first one I noticed.

10-07-2011, 03:24 AM
That is where I started.

Thanks for asking.

Old Pedant
10-07-2011, 03:48 AM
Okay...I get it, finally.

It would help if you understood the <form> you were using.

<script type="text/javascript">
function magCheck()
var form = document.forms[0];
var isChecked = form.magcheckbox.checked;
form.meta_web_form_id.value = isChecked ? '1355523361' : '1357528764';
form.listname = isChecked ? "keylivingwell" : "keylivingwund";

Old Pedant
10-07-2011, 03:53 AM
We do not get errors.

Yes, you do. But clearly you have no idea that you are getting them.

EACH AND EVERY ONE of the errors that I pointed out in my post #7 is present in that code you posted. ALL of them.

If you are going to do *ANYTHING* more with JavaScript in the future, it is way past time that you used the Firefox browser and installed the Firebug plugin and learned to use it.

It likes going to List 1.

Sure, because as soon as hit the FIRST LINE of your magCheck function it got an error. And as soon as JS gets an error it simply QUITS RUNNING. So you were never making any changes in the <form>. So of course it always used the list that the <form> had been set up for originally.

10-07-2011, 04:15 AM
Thank you for your help,

You can imagine there is a story behind this. I am not the coder. I am the user.

The coder quit calling me when I told him I had a problem. He was so sure it worked because he had used it before with no problems (so he says).

He was doing me a favor by offering it to me! After I pointed out a few problems, he made a few changes. Now he is ignoring me altogether. I did not know the extent of the problems until you pointed them out.

I appreciate your input, but now that you have bestowed me with your words of wisdom, I may just start over with someone else or go to Plan B which was to do something different altogether. It would be something with which I am more familiar.

I do use Firefox and Firebug. I am no amateur, just not a javascript coder.

Thanks, again. I hope you do not think this was a waste of your time.

Regards, Pat

Old Pedant
10-07-2011, 05:28 AM
Nope, not at all a waste.

I think the part where I wondered w.t.h., though, was when you wrote "I have had other coders looking at it today. What we have now is the result of their input." Makes me wonder what kind of "coders" they were. Not JS codes, I assume?

I hope you know that I was still just guessing at the answer I gave. I can't be sure I did everything that the processor of that <form> needed to then do what you wanted. Kind of coding blind. If it worked, a minor miracle.

10-07-2011, 06:27 PM
It is a new beautiful day and I am now deciding what I should do with my code.

It wasn't such a bad idea. I complicated matters by mentioning the checkbox on all of my videos that I put on the squeeze pages--"Check the box at the bottom of the optin form to subscribe." If I abandon the idea and put the subscribe optin on the thank you page itself, I have to redo the videos.

What do you think about my going to Scriptlance or somewhere to find someone who can help me? I have never done that before because usually some one I know can handle it.

I just have this feeling that it is not going to take a lot to make it work.

Thanks for listening,


Old Pedant
10-08-2011, 07:30 AM
Well, there's a forum on this site where you can ask for freelance help.


It's not as nice to the users, but many many many sites nowadays make you *UNCHECK* a box in order to *NOT* to subscribe. (Or check the box to not subscribe...whatever. The point being that unless the user reads and follows the directions, he/she is automatically subscribed. Most sites *want* people to subscribe.)

But if you want to be really ultra-nice, have two buttons. One is "submit and subscribe" and the other is "submit without subscribing". One big advantage of this is legal: There is no way the user can later claim you sent him stuff he didn't subscribe to.