Page 3 of 7 FirstFirst 12345 ... LastLast
Results 21 to 30 of 70

Thread: Dynamic Forms

  1. #21
    Join Date
    Jul 2006
    Posts
    56
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    No I don't.
    omg. sorry about that.

  2. #22
    Join Date
    Jul 2006
    Posts
    56
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Weird...for some strange reason a domain input box shows up even when nothing is selected. It didn't used to do this. Did I screw something up?

    Code:
    <html>
    
    <head>
    <title>A Title</title>
    
    <style type="text/css">
    form#weboptions label {
      display: block;
    }
    </style>
    
    <script type="text/javascript">
    window.onload = function() {
      setupDependencies("weboptions");
    };
    
    function getRadioValue(el) {
      for(var i = 0; i < el.length; ++i)
        if(el[i].checked) return el[i].value;
      return null;
    }
    
    function setupDependencies() {
      var showEl = function() {
        this.style.display = "";
        if(this.parentNode.tagName.toLowerCase() == "label")
          this.parentNode.style.display = "";
      };
      var hideEl = function() {
        this.style.display = "none";
        if(this.parentNode.tagName.toLowerCase() == "label")
          this.parentNode.style.display = "none";
        this.hidden = true;
      };
      var calcDeps = function() {
        for(var i = 0, e = this.elements; i < e.length; ++i) {
          e[i].hidden = false;
          for(var j = 0, f = e[i].className.split(' '); j < f.length; ++j)
            if(f[j].indexOf("radiodepend-") === 0) {
              var n = f[j].split('-'),
                v = n[2];
              n = n[1];
              if(getRadioValue(e[n]) == v) {
                e[i].show();
              } else {
                e[i].hide();
                break;
              }
            } else if(f[j].indexOf("depends-") === 0) {
              for(var k = 0, g = f[j].substr(8).split("-OR-"); k < g.length; ++k)
                if(e[g[k]].checked) {
                  e[i].show();
                  break;
                } else if(k + 1 == g.length)
                  e[i].hide();
            } else if(f[j].indexOf("conflicts-") === 0)
              if(e[f[j].substr(10)].checked) {
                e[i].hide();
                break;
              }
          if(!e[i].hidden) e[i].show();
        }
      };
      var changeHandler = function() {
        this.form.calculateDependencies();
      };
      for(var i = 0; i < arguments.length; ++i) {
        for(var j = 0, e = window.document.forms[arguments[i]].elements; j < e.length; ++j) {
          e[j].onchange = changeHandler;
          e[j].hide = hideEl;
          e[j].show = showEl;
        }
    
        window.document.forms[arguments[i]].calculateDependencies = calcDeps;
        window.document.forms[arguments[i]].calculateDependencies();
      }
    }
    </script>
    
    </head>
    
    <body>
    
    <form action="" name="weboptions" id="weboptions">
    <p>
    	<label><input type="checkbox" name="TheWebDevelopmentPackage"> The Web Development Package</label>
    	<label><input type="checkbox" name="TheWebDesignPackage"> The Web Design Package</label>
    	<label><input type="checkbox" name="TheWebHostingPackage"> The Web Hosting Package</label>
    	<label><input type="checkbox" name="TheDomainRegistrationPackage"> The Domain Registration Package</label>
    	<label><input type="checkbox" name="TheSearchEngineOptimizationPackage"> The Search Engine Optimization 
    
    Package</label>
    </p>
    
    <!-- The Web Development Package -->
    <!-- Inlcudes everything -->
    
    <!-- The Web Design Package 
    <p>
    	<label>Description of Design: <textarea width="3" height="5" name="DescriptionofDesign" class="depends-
    
    TheWebDevelopmentPackage-OR-TheWebDesignPackage"></textarea></label>
    </p>
    -->
    
    <!-- The Web Hosting Package -->
    <p>
    	<label><input type="radio" name="HostingSpace" value="1GB" class="depends-TheWebDevelopmentPackage-OR-
    
    TheWebHostingPackage">1GB &nbsp;&nbsp;- 20GB of Bandwidth - $0.99/mo</label>
    	<label><input type="radio" name="HostingSpace" value="3GB" class="depends-TheWebDevelopmentPackage-OR-
    
    TheWebHostingPackage">3GB &nbsp;&nbsp;- 20GB of Bandwidth - $1.99/mo</label>
    	<label><input type="radio" name="HostingSpace" value="5GB" class="depends-TheWebDevelopmentPackage-OR-
    
    TheWebHostingPackage">5GB &nbsp;&nbsp;- 20GB of Bandwidth - $2.99/mo</label>
    	<label><input type="radio" name="HostingSpace" value="10GB" class="depends-TheWebDevelopmentPackage-OR-
    
    TheWebHostingPackage">10GB - 20GB of Bandwidth - $4.99/mo</label>
    	<label><input type="checkbox" name="AddaDomainName" class="depends-TheWebHostingPackage conflicts-
    
    TheWebDevelopmentPackage conflicts-TheDomainRegistrationPackage"> Add a Domain Name - $9.99/yr 
    
    &nbsp;&nbsp;&nbsp;&nbsp;<font size="-2">For more Domain Names, you must purchase The Domain Registration Package. 
    
    $9.99/yr ea.</font></label>
    </p>
    
    <!-- The Domain Registration Package -->
    <p>
    	<label><input type="radio" checked name="Domain" value="1Domain" class="depends-TheWebDevelopmentPackage-
    
    OR-TheDomainRegistrationPackage"> 1 Domain &nbsp;- $9.99/yr ea.</label>
    	<label><input type="radio" name="Domain" value="2Domains" class="depends-TheWebDevelopmentPackage-OR-
    
    TheDomainRegistrationPackage"> 2 Domains - $9.99/yr ea.</label>
    	<label><input type="radio" name="Domain" value="3Domains" class="depends-TheWebDevelopmentPackage-OR-
    
    TheDomainRegistrationPackage"> 3 Domains - $9.99/yr ea.</label>
    	<label><input type="radio" name="Domain" value="4Domains" class="depends-TheWebDevelopmentPackage-OR-
    
    TheDomainRegistrationPackage"> 4 Domains - $9.99/yr ea.</label>
    	<label><input type="radio" name="Domain" value="5Domains" class="depends-TheWebDevelopmentPackage-OR-
    
    TheDomainRegistrationPackage"> 5 Domains - $9.99/yr ea. &nbsp;&nbsp;&nbsp;<font size="-2"><a 
    
    href="mailto:webmaster@chillentertainment.com">Email Chill Entertainment for more than 5 domain 
    
    names</a></font></label>
    
    	<label><br />Domain Name: <input type="text" name="DesiredDomainName1" class="depends-
    
    TheWebDevelopmentPackage-OR-TheDomainRegistrationPackage-OR-AddaDomainName"></label>
    	<label>Extension: <select name="Extension1" class="depends-TheWebDevelopmentPackage-OR-
    
    TheDomainRegistrationPackage-OR-AddaDomainName">
    		<option>.com</option>
    		<option>.org</option>
    		<option>.net</option>
    	</select></label>
    
    	<label><br />Domain Name: <input type="text" name="DesiredDomainName2" class="radiodepend-Domain-
    
    2Domains"></label>
    	<label>Extension: <select name="Extension2" class="radiodepend-Domain-2Domains">
    		<option>.com</option>
    		<option>.org</option>
    		<option>.net</option>
    	</select></label>
    
    	<label><br />Domain Name: <input type="text" name="DesiredDomainName3" class="radiodepend-Domain-
    
    3Domains"></label>
    	<label>Extension: <select name="Extension3" class="radiodepend-Domain-3Domains">
    		<option>.com</option>
    		<option>.org</option>
    		<option>.net</option>
    	</select></label>
    	<label><br />Domain Name: <input type="text" name="DesiredDomainName3" class="radiodepend-Domain-
    
    3Domains"></label>
    	<label>Extension: <select name="Extension3" class="radiodepend-Domain-3Domains">
    		<option>.com</option>
    		<option>.org</option>
    		<option>.net</option>
    	</select></label>
    
    	<label><br />Domain Name: <input type="text" name="DesiredDomainName4" class="radiodepend-Domain-
    
    4Domains"></label>
    	<label>Extension: <select name="Extension4" class="radiodepend-Domain-4Domains">
    		<option>.com</option>
    		<option>.org</option>
    		<option>.net</option>
    	</select></label>
    	<label><br />Domain Name: <input type="text" name="DesiredDomainName4" class="radiodepend-Domain-
    
    4Domains"></label>
    	<label>Extension: <select name="Extension4" class="radiodepend-Domain-4Domains">
    		<option>.com</option>
    		<option>.org</option>
    		<option>.net</option>
    	</select></label>
    	<label><br />Domain Name: <input type="text" name="DesiredDomainName4" class="radiodepend-Domain-
    
    4Domains"></label>
    	<label>Extension: <select name="Extension4" class="radiodepend-Domain-4Domains">
    		<option>.com</option>
    		<option>.org</option>
    		<option>.net</option>
    	</select></label>
    
    
    	<label><br />Domain Name: <input type="text" name="DesiredDomainName5" class="radiodepend-Domain-
    
    5Domains"></label>
    	<label>Extension: <select name="Extension5" class="radiodepend-Domain-5Domains">
    		<option>.com</option>
    		<option>.org</option>
    		<option>.net</option>
    	</select></label>
    	<label><br />Domain Name: <input type="text" name="DesiredDomainName5" class="radiodepend-Domain-
    
    5Domains"></label>
    	<label>Extension: <select name="Extension5" class="radiodepend-Domain-5Domains">
    		<option>.com</option>
    		<option>.org</option>
    		<option>.net</option>
    	</select></label>
    	<label><br />Domain Name: <input type="text" name="DesiredDomainName5" class="radiodepend-Domain-
    
    5Domains"></label>
    	<label>Extension: <select name="Extension5" class="radiodepend-Domain-5Domains">
    		<option>.com</option>
    		<option>.org</option>
    		<option>.net</option>
    	</select></label>
    	<label><br />Domain Name: <input type="text" name="DesiredDomainName5" class="radiodepend-Domain-
    
    5Domains"></label>
    	<label>Extension: <select name="Extension5" class="radiodepend-Domain-5Domains">
    		<option>.com</option>
    		<option>.org</option>
    		<option>.net</option>
    	</select></label>
    
    
    </p>
    
    <!-- The Search Engine Optimization Package -->
    <p>
    </p>
    
    
    </form>
    
    </body>
    </html>

  3. #23
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,878
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Yes, here:
    Code:
    	<label><br />Domain Name: <input type="text" name="DesiredDomainName1" class="depends-
    
    TheWebDevelopmentPackage-OR-TheDomainRegistrationPackage-OR-AddaDomainName"></label>
    No linebreaks or spaces are allowed between portions of the class. Between classes is fine, but not inside them.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  4. #24
    Join Date
    Jul 2006
    Posts
    56
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Oh, alright. Thanks again man!

  5. #25
    Join Date
    Jul 2006
    Posts
    56
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Alright, I found some more bugs...
    Hopefully these would be easy to fix.

    Test out this code in a browser.
    Check "The Domain Registration Package".
    Select the "5 Domains" radio button.
    And deselect "The Domain Registration Package" checkbox.

    Four of the domain input boxes still remain.

    Can you help me on this?

    Code:
    <html>
    
    <head>
    <title>A Title</title>
    
    <style type="text/css">
    form#weboptions label {
      display: block;
    }
    </style>
    
    <script type="text/javascript">
    window.onload = function() {
      setupDependencies("weboptions");
    };
    
    function getRadioValue(el) {
      for(var i = 0; i < el.length; ++i)
        if(el[i].checked) return el[i].value;
      return null;
    }
    
    function setupDependencies() {
      var showEl = function() {
        this.style.display = "";
        if(this.parentNode.tagName.toLowerCase() == "label")
          this.parentNode.style.display = "";
      };
      var hideEl = function() {
        this.style.display = "none";
        if(this.parentNode.tagName.toLowerCase() == "label")
          this.parentNode.style.display = "none";
        this.hidden = true;
      };
      var calcDeps = function() {
        for(var i = 0, e = this.elements; i < e.length; ++i) {
          e[i].hidden = false;
          for(var j = 0, f = e[i].className.split(' '); j < f.length; ++j)
            if(f[j].indexOf("radiodepend-") === 0) {
              var n = f[j].split('-'),
                v = n[2];
              n = n[1];
              if(getRadioValue(e[n]) == v) {
                e[i].show();
              } else {
                e[i].hide();
                break;
              }
            } else if(f[j].indexOf("depends-") === 0) {
              for(var k = 0, g = f[j].substr(8).split("-OR-"); k < g.length; ++k)
                if(e[g[k]].checked) {
                  e[i].show();
                  break;
                } else if(k + 1 == g.length)
                  e[i].hide();
            } else if(f[j].indexOf("conflicts-") === 0)
              if(e[f[j].substr(10)].checked) {
                e[i].hide();
                break;
              }
          if(!e[i].hidden) e[i].show();
        }
      };
      var changeHandler = function() {
        this.form.calculateDependencies();
      };
      for(var i = 0; i < arguments.length; ++i) {
        for(var j = 0, e = window.document.forms[arguments[i]].elements; j < e.length; ++j) {
          e[j].onchange = changeHandler;
          e[j].hide = hideEl;
          e[j].show = showEl;
        }
    
        window.document.forms[arguments[i]].calculateDependencies = calcDeps;
        window.document.forms[arguments[i]].calculateDependencies();
      }
    }
    </script>
    
    </head>
    
    <body>
    
    <form action="" name="weboptions" id="weboptions">
    <p>
    	<label><input type="checkbox" name="TheWebDevelopmentPackage"> The Web Development Package</label>
    	<label><input type="checkbox" name="TheWebDesignPackage"> The Web Design Package</label>
    	<label><input type="checkbox" name="TheWebHostingPackage"> The Web Hosting Package</label>
    	<label><input type="checkbox" name="TheDomainRegistrationPackage"> The Domain Registration Package</label>
    	<label><input type="checkbox" name="TheSearchEngineOptimizationPackage"> The Search Engine Optimization 
    
    Package</label>
    </p>
    
    <!-- The Web Development Package -->
    <!-- Inlcudes everything -->
    
    <!-- The Web Design Package 
    <p>
    	<label>Description of Design: <textarea width="3" height="5" name="DescriptionofDesign" class="depends-
    
    TheWebDevelopmentPackage-OR-TheWebDesignPackage"></textarea></label>
    </p>
    -->
    
    <!-- The Web Hosting Package -->
    <p>
    	<label><input type="radio" name="HostingSpace" value="1GB" class="depends-TheWebDevelopmentPackage-OR-
    
    TheWebHostingPackage">1GB &nbsp;&nbsp;- 20GB of Bandwidth - $0.99/mo</label>
    	<label><input type="radio" name="HostingSpace" value="3GB" class="depends-TheWebDevelopmentPackage-OR-
    
    TheWebHostingPackage">3GB &nbsp;&nbsp;- 20GB of Bandwidth - $1.99/mo</label>
    	<label><input type="radio" name="HostingSpace" value="5GB" class="depends-TheWebDevelopmentPackage-OR-
    
    TheWebHostingPackage">5GB &nbsp;&nbsp;- 20GB of Bandwidth - $2.99/mo</label>
    	<label><input type="radio" name="HostingSpace" value="10GB" class="depends-TheWebDevelopmentPackage-OR-
    
    TheWebHostingPackage">10GB - 20GB of Bandwidth - $4.99/mo</label>
    	<label><input type="checkbox" name="AddaDomainName" class="depends-TheWebHostingPackage conflicts-
    
    TheWebDevelopmentPackage conflicts-TheDomainRegistrationPackage"> Add a Domain Name - $9.99/yr 
    
    &nbsp;&nbsp;&nbsp;&nbsp;<font size="-2">For more Domain Names, you must purchase The Domain Registration Package. 
    
    $9.99/yr ea.</font></label>
    </p>
    
    <!-- The Domain Registration Package -->
    <p>
    	<label><input type="radio" checked name="Domain" value="1Domain" class="depends-TheWebDevelopmentPackage-
    
    OR-TheDomainRegistrationPackage"> 1 Domain &nbsp;- $9.99/yr ea.</label>
    	<label><input type="radio" name="Domain" value="2Domains" class="depends-TheWebDevelopmentPackage-OR-
    
    TheDomainRegistrationPackage"> 2 Domains - $9.99/yr ea.</label>
    	<label><input type="radio" name="Domain" value="3Domains" class="depends-TheWebDevelopmentPackage-OR-
    
    TheDomainRegistrationPackage"> 3 Domains - $9.99/yr ea.</label>
    	<label><input type="radio" name="Domain" value="4Domains" class="depends-TheWebDevelopmentPackage-OR-
    
    TheDomainRegistrationPackage"> 4 Domains - $9.99/yr ea.</label>
    	<label><input type="radio" name="Domain" value="5Domains" class="depends-TheWebDevelopmentPackage-OR-
    
    TheDomainRegistrationPackage"> 5 Domains - $9.99/yr ea. &nbsp;&nbsp;&nbsp;<font size="-2"><a 
    
    href="mailto:webmaster@chillentertainment.com">Email Chill Entertainment for more than 5 domain 
    
    names</a></font></label>
    
    
    	<label>Domain Name: <input type="text" name="DesiredDomainName1" class="depends-TheWebDevelopmentPackage-
    
    OR-TheDomainRegistrationPackage-OR-AddaDomainName"></label>
    	<label>Extension: <select name="Extension1" class="depends-TheWebDevelopmentPackage-OR-
    
    TheDomainRegistrationPackage-OR-AddaDomainName">
    		<option>.com</option>
    		<option>.org</option>
    		<option>.net</option>
    	</select></label>
    
    	<label>Domain Name: <input type="text" name="DesiredDomainName2" class="radiodepend-Domain-
    
    2Domains"></label>
    	<label>Extension: <select name="Extension2" class="radiodepend-Domain-2Domains">
    		<option>.com</option>
    		<option>.org</option>
    		<option>.net</option>
    	</select></label>
    
    	<label>Domain Name: <input type="text" name="DesiredDomainName3" class="radiodepend-Domain-
    
    3Domains"></label>
    	<label>Extension: <select name="Extension3" class="radiodepend-Domain-3Domains">
    		<option>.com</option>
    		<option>.org</option>
    		<option>.net</option>
    	</select></label>
    	<label>Domain Name: <input type="text" name="DesiredDomainName3" class="radiodepend-Domain-
    
    3Domains"></label>
    	<label>Extension: <select name="Extension3" class="radiodepend-Domain-3Domains">
    		<option>.com</option>
    		<option>.org</option>
    		<option>.net</option>
    	</select></label>
    
    
    
    	<label>Domain Name: <input type="text" name="DesiredDomainName4" class="radiodepend-Domain-
    
    4Domains"></label>
    	<label>Extension: <select name="Extension4" class="radiodepend-Domain-4Domains">
    		<option>.com</option>
    		<option>.org</option>
    		<option>.net</option>
    	</select></label>
    	<label>Domain Name: <input type="text" name="DesiredDomainName4" class="radiodepend-Domain-
    
    4Domains"></label>
    	<label>Extension: <select name="Extension4" class="radiodepend-Domain-4Domains">
    		<option>.com</option>
    		<option>.org</option>
    		<option>.net</option>
    	</select></label>
    	<label>Domain Name: <input type="text" name="DesiredDomainName4" class="radiodepend-Domain-
    
    4Domains"></label>
    	<label>Extension: <select name="Extension4" class="radiodepend-Domain-4Domains">
    		<option>.com</option>
    		<option>.org</option>
    		<option>.net</option>
    	</select></label>
    
    
    	<label>Domain Name: <input type="text" name="DesiredDomainName5" class="radiodepend-Domain-
    
    5Domains"></label>
    	<label>Extension: <select name="Extension5" class="radiodepend-Domain-5Domains">
    		<option>.com</option>
    		<option>.org</option>
    		<option>.net</option>
    	</select></label>
    	<label>Domain Name: <input type="text" name="DesiredDomainName5" class="radiodepend-Domain-
    
    5Domains"></label>
    	<label>Extension: <select name="Extension5" class="radiodepend-Domain-5Domains">
    		<option>.com</option>
    		<option>.org</option>
    		<option>.net</option>
    	</select></label>
    	<label>Domain Name: <input type="text" name="DesiredDomainName5" class="radiodepend-Domain-
    
    5Domains"></label>
    	<label>Extension: <select name="Extension5" class="radiodepend-Domain-5Domains">
    		<option>.com</option>
    		<option>.org</option>
    		<option>.net</option>
    	</select></label>
    	<label>Domain Name: <input type="text" name="DesiredDomainName5" class="radiodepend-Domain-
    
    5Domains"></label>
    	<label>Extension: <select name="Extension5" class="radiodepend-Domain-5Domains">
    		<option>.com</option>
    		<option>.org</option>
    		<option>.net</option>
    	</select></label>
    
    
    </p>
    
    <!-- The Search Engine Optimization Package -->
    <p>
    </p>
    
    
    </form>
    
    </body>
    </html>

  6. #26
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,878
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    
    <html>
    
    <head>
    <title>A Title</title>
    
    <style type="text/css">
    form#weboptions label {
      display: block;
    }
    </style>
    
    <script type="text/javascript">
    window.onload = function() {
      setupDependencies("weboptions");
    };
    
    function getRadioValue(el) {
      for(var i = 0; i < el.length; ++i)
        if(el[i].checked) return el[i].value;
      return null;
    }
    
    function setupDependencies() {
      var showEl = function() {
        this.style.display = "";
        if(this.parentNode.tagName.toLowerCase() == "label")
          this.parentNode.style.display = "";
      };
      var hideEl = function() {
        this.style.display = "none";
        if(this.parentNode.tagName.toLowerCase() == "label")
          this.parentNode.style.display = "none";
        this.hidden = true;
      };
      var calcDeps = function() {
        for(var i = 0, e = this.elements; i < e.length; ++i) {
          e[i].hidden = false;
          for(var j = 0, f = e[i].className.split(' '); j < f.length; ++j)
            if(f[j].indexOf("depends-") === 0) {
              for(var k = 0, g = f[j].substr(8).split("-OR-"); k < g.length; ++k)
                if(g[k].indexOf("-IS-") === -1) {
                  if(!e[g[k]])
    	        alert("Warning: Non-existent dependency on " + e[i].name + ".");
    	      else if(e[g[k]].checked) break;
                  else if(k + 1 == g.length)
                    e[i].hide();
                } else {
                  var n = g[k].split("-IS-"),
                    v = n[1];
                  n = n[0];
                  if(!e[n])
    	        alert("Warning: Non-existent dependency on " + e[i].name + ".");
    	      else
    	        if(
    	          (getRadioValue(e[n]) == v) ||
    	          (e[n].value == v)
    	        ) break;
    	        else if(k + 1 == g.length) {
    	          e[i].hide();
    	        }
    	    }
            } else if(f[j].indexOf("conflicts-") === 0) {
              if(f[j].indexOf("-IS-") === -1) {
                if(!e[f[j].substr(10)])
    	      alert("Warning: Non-existent confliction on " + e[i].name + ".");
    	    else if(e[f[j].substr(10)].checked) {
                  e[i].hide();
                  break;
                }
              } else {
                var n = f[j].substr(10).split("-IS-"),
                  v = n[1];
                n = n[0];
                if(!e[n])
                  alert("Warning: Non-existent confliction on " + e[i].name + ".");
                else {
                  if(getRadioValue(e[n]) == v || e[n].value == v) {
                    e[i].hide();
                    break;
                  }
                }
              }
            }
          if(!e[i].hidden) e[i].show();
        }
      };
      var changeHandler = function() {
        this.form.calculateDependencies();
      };
      for(var i = 0; i < arguments.length; ++i) {
        for(var j = 0, e = window.document.forms[arguments[i]].elements; j < e.length; ++j) {
          e[j].onchange = changeHandler;
          e[j].hide = hideEl;
          e[j].show = showEl;
        }
    
        window.document.forms[arguments[i]].calculateDependencies = calcDeps;
        window.document.forms[arguments[i]].calculateDependencies();
      }
    }
    </script>
    
    </head>
    
    <body>
    
    <form action="" name="weboptions" id="weboptions">
    <p>
    	<label><input type="checkbox" name="TheWebDevelopmentPackage"> The Web Development Package</label>
    	<label><input type="checkbox" name="TheWebDesignPackage"> The Web Design Package</label>
    	<label><input type="checkbox" name="TheWebHostingPackage"> The Web Hosting Package</label>
    	<label><input type="checkbox" name="TheDomainRegistrationPackage"> The Domain Registration Package</label>
    	<label><input type="checkbox" name="TheSearchEngineOptimizationPackage"> The Search Engine Optimization Package</label>
    </p>
    
    <!-- The Web Development Package -->
    <!-- Inlcudes everything -->
    
    <!-- The Web Design Package 
    <p>
    	<label>Description of Design: <textarea width="3" height="5" name="DescriptionofDesign" class="depends-TheWebDevelopmentPackage-OR-TheWebDesignPackage"></textarea></label>
    </p>
    -->
    
    <!-- The Web Hosting Package -->
    <p>
    	<label><input type="radio" name="HostingSpace" value="1GB" class="depends-TheWebDevelopmentPackage-OR-TheWebHostingPackage">1GB &nbsp;&nbsp;- 20GB of Bandwidth - $0.99/mo</label>
    	<label><input type="radio" name="HostingSpace" value="3GB" class="depends-TheWebDevelopmentPackage-OR-TheWebHostingPackage">3GB &nbsp;&nbsp;- 20GB of Bandwidth - $1.99/mo</label>
    	<label><input type="radio" name="HostingSpace" value="5GB" class="depends-TheWebDevelopmentPackage-OR-TheWebHostingPackage">5GB &nbsp;&nbsp;- 20GB of Bandwidth - $2.99/mo</label>
    	<label><input type="radio" name="HostingSpace" value="10GB" class="depends-TheWebDevelopmentPackage-OR-TheWebHostingPackage">10GB - 20GB of Bandwidth - $4.99/mo</label>
    	<label><input type="checkbox" name="AddaDomainName" class="depends-TheWebHostingPackage conflicts-TheWebDevelopmentPackage conflicts-TheDomainRegistrationPackage"> Add a Domain Name - $9.99/yr 
    
    &nbsp;&nbsp;&nbsp;&nbsp;<font size="-2">For more Domain Names, you must purchase The Domain Registration Package. 
    
    $9.99/yr ea.</font></label>
    </p>
    
    <!-- The Domain Registration Package -->
    <p>
    	<label><input type="radio" checked name="Domain" value="1Domain" class="depends-TheWebDevelopmentPackage-OR-TheDomainRegistrationPackage"> 1 Domain &nbsp;- $9.99/yr ea.</label>
    	<label><input type="radio" name="Domain" value="2Domains" class="depends-TheWebDevelopmentPackage-OR-TheDomainRegistrationPackage"> 2 Domains - $9.99/yr ea.</label>
    	<label><input type="radio" name="Domain" value="3Domains" class="depends-TheWebDevelopmentPackage-OR-TheDomainRegistrationPackage"> 3 Domains - $9.99/yr ea.</label>
    	<label><input type="radio" name="Domain" value="4Domains" class="depends-TheWebDevelopmentPackage-OR-TheDomainRegistrationPackage"> 4 Domains - $9.99/yr ea.</label>
    	<label><input type="radio" name="Domain" value="5Domains" class="depends-TheWebDevelopmentPackage-OR-TheDomainRegistrationPackage"> 5 Domains - $9.99/yr ea. &nbsp;&nbsp;&nbsp;<font size="-2"><a href="mailto:webmaster@chillentertainment.com">Email Chill Entertainment for more than 5 domain names</a></font></label>
    
    
    	<label>Domain Name: <input type="text" name="DesiredDomainName1" class="depends-TheWebDevelopmentPackage-OR-TheDomainRegistrationPackage-OR-AddaDomainName"></label>
    	<label>Extension: <select name="Extension1" class="depends-TheWebDevelopmentPackage-OR-TheDomainRegistrationPackage-OR-AddaDomainName">
    		<option>.com</option>
    		<option>.org</option>
    		<option>.net</option>
    	</select></label>
    
    	<label>Domain Name: <input type="text" name="DesiredDomainName2" class="conflicts-Domain-IS-1Domain depends-TheWebDevelopmentPackage-OR-TheDomainRegistrationPackage-OR-AddaDomainName"></label>
    	<label>Extension: <select name="Extension2" class="conflicts-Domain-IS-1Domain depends-TheWebDevelopmentPackage-OR-TheDomainRegistrationPackage-OR-AddaDomainName">
    		<option>.com</option>
    		<option>.org</option>
    		<option>.net</option>
    	</select></label>
    
    	<label>Domain Name: <input type="text" name="DesiredDomainName3" class="conflicts-Domain-IS-1Domain conflicts-Domain-IS-2Domains depends-TheWebDevelopmentPackage-OR-TheDomainRegistrationPackage-OR-AddaDomainName"></label>
    	<label>Extension: <select name="Extension3" class="conflicts-Domain-IS-1Domain conflicts-Domain-IS-2Domains depends-TheWebDevelopmentPackage-OR-TheDomainRegistrationPackage-OR-AddaDomainName">
    		<option>.com</option>
    		<option>.org</option>
    		<option>.net</option>
    	</select></label>
    
    	<label>Domain Name: <input type="text" value="4" name="DesiredDomainName4" class="depends-Domain-IS-4Domains-OR-Domain-IS-5Domains depends-TheWebDevelopmentPackage-OR-TheDomainRegistrationPackage-OR-AddaDomainName"></label>
    	<label>Extension: <select name="Extension4" class="depends-Domain-IS-4Domains-OR-Domain-IS-5Domains depends-TheWebDevelopmentPackage-OR-TheDomainRegistrationPackage-OR-AddaDomainName">
    		<option>.com</option>
    		<option>.org</option>
    		<option>.net</option>
    	</select></label>
    
    	<label>Domain Name: <input type="text" name="DesiredDomainName5" class="depends-Domain-IS-5Domains depends-TheWebDevelopmentPackage-OR-TheDomainRegistrationPackage-OR-AddaDomainName"></label>
    	<label>Extension: <select name="Extension5" class="depends-Domain-IS-5Domains depends-TheWebDevelopmentPackage-OR-TheDomainRegistrationPackage-OR-AddaDomainName">
    		<option>.com</option>
    		<option>.org</option>
    		<option>.net</option>
    	</select></label>
    
    
    </p>
    
    <!-- The Search Engine Optimization Package -->
    <p>
    </p>
    
    
    </form>
    
    </body>
    </html>
    That problem was due to the way you'd set up dependencies While looking at it, though, I realised that to do your domain names setup would require either an OR or a conflict for radio options, so I removed radiodepend and replaced it with -IS-. Syntax:
    Code:
    depends-name-IS-value
    This works with "conflicts" as well, and should function with any type of input.

    Do you use an IDE or a text editor that inserts line breaks (like Microsoft Notepad with "Word Wrap" enabled)? It seems that whenever you post some code, a fresh bunch of line breaks appear where they shouldn't be

    Please do tell me if you find any more problems, since this script is getting to the level of complexity at which I'd consider submitting it to DD (although I pity the poor people who'll try to mod it...).
    Last edited by Twey; 07-29-2006 at 09:27 PM.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  7. #27
    Join Date
    Jul 2006
    Posts
    56
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Alright, great. Thank you.
    Yes, I used Notepad with WordWrap enabled for this code.

    Great, it works perfectly, except for one problem I noticed earlier before (, but for some reason I forgot to post it).

    Test out this code in a browser.
    Check "The Web Hosting Package".
    Select the "Add a Domain" checkboxes.
    And deselect "The Web Hosting Package" checkbox.

    The domain input box still remains.

  8. #28
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,878
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Because that's how you coded it. You explicitly said:
    Code:
    	<label>Domain Name: <input type="text" name="DesiredDomainName1" class="depends-TheWebDevelopmentPackage-OR-TheDomainRegistrationPackage-OR-AddaDomainName"></label>
    If you want to uncheck boxes when they're hidden, add these lines to the hideEl function:
    Code:
      var hideEl = function() {
        this.style.display = "none";
        if(typeof this.checked !== "undefined") this.checked = false;
        else this.value = "";
        if(this.parentNode.tagName.toLowerCase() == "label")
          this.parentNode.style.display = "none";
        this.hidden = true;
      };
    I suggest you disable WordWrap. It seems to be rather indiscriminate about where it puts its linebreaks.
    Last edited by Twey; 07-30-2006 at 12:07 AM.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  9. #29
    Join Date
    Jul 2006
    Posts
    56
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Awesome. Thanks for everything dude.
    It works great.

    I need to learn Javascript. lol

  10. #30
    Join Date
    Jul 2006
    Posts
    56
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Oh, ugh...this script doesn't seem to work in Internet Explorer...

    Can you help me with this?

Bookmarks

Posting Permissions

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