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.
Page 1 of 2 12 LastLast
Results 1 to 15 of 18
  1. #1
    New Coder
    Join Date
    Sep 2011
    Location
    Orange County, California
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Stuck on this Checkbox Code

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

    }
    }

    </script>
    {
    }
    </style>
    <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>
    <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>
    <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>
    <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>
    <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>
    <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>
    </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

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

    /></div>
    </form>
    <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";
    }
    }
    })();
    -->
    </script>

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

    Pat

  • #2
    Senior Coder Logic Ali's Avatar
    Join Date
    Sep 2010
    Location
    London
    Posts
    1,028
    Thanks
    0
    Thanked 207 Times in 202 Posts
    It would be easy to point to the error, but the error console must be doing it for you. Try using it.

  • #3
    New Coder
    Join Date
    Sep 2011
    Location
    Orange County, California
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I have.

    Right now--everyone subscribes.

  • #4
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,208
    Thanks
    75
    Thanked 4,343 Times in 4,309 Posts
    Don't you mean the THREE errors, Logic?

    At least three, anyway.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #5
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,208
    Thanks
    75
    Thanked 4,343 Times in 4,309 Posts
    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.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #6
    New Coder
    Join Date
    Sep 2011
    Location
    Orange County, California
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Well, new eyes are not helping.

    You are also confirming it isn't easy.

    Pat

  • #7
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,208
    Thanks
    75
    Thanked 4,343 Times in 4,309 Posts
    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.

    EDIT:

    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.
    Last edited by Old Pedant; 10-07-2011 at 12:20 AM.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #8
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,208
    Thanks
    75
    Thanked 4,343 Times in 4,309 Posts
    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.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #9
    New Coder
    Join Date
    Sep 2011
    Location
    Orange County, California
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hey,

    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.

    Pat

  • #10
    New Coder
    Join Date
    Sep 2011
    Location
    Orange County, California
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Old Pedant View Post
    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.

    Pat

  • #11
    Senior Coder Logic Ali's Avatar
    Join Date
    Sep 2010
    Location
    London
    Posts
    1,028
    Thanks
    0
    Thanked 207 Times in 202 Posts
    Quote Originally Posted by Old Pedant View Post
    Don't you mean the THREE errors, Logic?

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

  • #12
    New Coder
    Join Date
    Sep 2011
    Location
    Orange County, California
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts
    That is where I started.

    Thanks for asking.

  • #13
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,208
    Thanks
    75
    Thanked 4,343 Times in 4,309 Posts
    Okay...I get it, finally.

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

    Code:
    <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";
    }
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #14
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,208
    Thanks
    75
    Thanked 4,343 Times in 4,309 Posts
    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.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

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


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

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