Page 2 of 2 FirstFirst 12
Results 11 to 14 of 14
  1. #11
    Join Date
    Jul 2011
    Posts
    177
    Plugin Contributions
    0

    Default Re: Dim Form Elements if Checkbox = True

    He updated his code to include the document ready function. I was told to put this in my <head> tag, so I opened up html_header.php, and put it just after the <head>.

    Still didn't work. I am pretty sure the issue lies somewhere other than the code itself.

    PLEASE, PLEASE, PLEAAAASEE can someone assist!!

    Code:
    <script type="text/javascript">
    $(document).ready(function(){
    //Initalize
        if($("#shippingAddress-checkbox").attr("checked") == "checked")
        {
            $("#shippingField input:not(#shippingAddress-checkbox), #shippingField select").attr("disabled", "disabled");
        }
        else
        {
            $("#shippingField input:not(#shippingAddress-checkbox), #shippingField select").removeAttr("disabled");               
        }
    
        //Setup action
        $("#shippingAddress-checkbox").click(function(){
           if($(this).attr("checked") == "checked")
           {
               $("#shippingField input:not(#shippingAddress-checkbox), #shippingField select").attr("disabled", "disabled");
           }
           else
           {
               $("#shippingField input:not(#shippingAddress-checkbox), #shippingField select").removeAttr("disabled");               
           }
        });​
    });
    </script>

  2. #12
    Join Date
    Jul 2011
    Posts
    177
    Plugin Contributions
    0

    Default Re: Dim Form Elements if Checkbox = True

    This is a screenshot of my live dev tools, might help someone diagnose the problem..
    http://i47.tinypic.com/357j9sk.png

  3. #13
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Dim Form Elements if Checkbox = True

    So it appears that something is inserting a ? after that line when it runs?? I don't know exactly what "token" signifies in javascript. Is the ? the problem, or a marker to show that a problem exists there?
    Code:
          }
        });​?
    });
    </script>

  4. #14
    Join Date
    Jul 2011
    Posts
    177
    Plugin Contributions
    0

    Default Re: Dim Form Elements if Checkbox = True

    Quote Originally Posted by gjh42 View Post
    So it appears that something is inserting a ? after that line when it runs?? I don't know exactly what "token" signifies in javascript. Is the ? the problem, or a marker to show that a problem exists there?
    Code:
          }
        });​?
    });
    </script>
    I removed the ? and another error occured, this time telling me that something is not defined. I googled the error and apparently this happens if a library has not been loaded. I placed this just before my formdim code...

    Code:
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.js"></script>
    and it worked!!!
    I can sleep easy tonight :)

    THANK YOU SIR

 

 
Page 2 of 2 FirstFirst 12

Similar Threads

  1. Odd extra elements in URL after form submission
    By gjh42 in forum Contribution-Writing Guidelines
    Replies: 5
    Last Post: 28 Aug 2014, 04:40 PM
  2. Replies: 10
    Last Post: 12 Nov 2009, 07:07 PM
  3. Gigantic button imgs and form elements!
    By theapeman in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 2 Jun 2007, 08:16 PM

Posting Permissions

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