SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Evangelist cturner01's Avatar
    Join Date
    Jun 2006
    Location
    My computer
    Posts
    408
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy Combo box isn't working properly???

    When I test my code that is below only the Trademark Owner selection works. I haven't posted all of my code as there are lots of it. Can someone please have a look at my code and tell me why the other options aren't working? Thanks in advance.

    Code JavaScript:
    	function dropdown1() {
    	var a = document.getElementById('eligibilitytype').value;
    	// textboxes, etc
    	var regidtype1 = document.getElementById('regidtype1');
    	var regidno1 = document.getElementById('regidno1');
    	var regidno2 = document.getElementById('regidno2');
    	var eligidtype2 = document.getElementById('eligidtype2');
    	var eligname1 = document.getElementById('eligname1');
    	var eligidno2 = document.getElementById('eligidno2');
    	var eligname2 = document.getElementById('eligname2');
    	// classes
    	var regidtype2 = document.getElementById('regidtype2');
    	var regidno = document.getElementById('regidno');
    	var eligidtype1 = document.getElementById('eligidtype1');
    	var eligidno1 = document.getElementById('eligidno1');
    	var eligidname1 = document.getElementById('eligidname1');
    	var abnacn = document.getElementById('abnacn');
    	var assocno = document.getElementById('assocno');
    	var abnacnbn = document.getElementById('abnacnbn');
    	var tradename = document.getElementById('tradename');
    	var tradeno = document.getElementById('tradeno');
        if (a == "Company") {
    		// for company
    		regidtype2.style.visibility = "visible";
    		regidno.style.visibility = "visible";
    		abnacn.style.visibility = "visible";
    		regidtype1.style.visibility = "visible";
    		regidno1.style.visibility = "visible";
    		// for other combo box options
    		assocno.style.visibility = "hidden";
    		regidno2.style.visibility = "hidden";
    		eligidtype2.style.visibility = "hidden";
    		eligidno1.style.visibility = "hidden";
    		abnacnbn.style.visibility = "hidden";
    		eligidtype1.style.visibility = "hidden";
    		eligidno1.style.visibility = "hidden";
    		eligname1.style.visibility = "hidden";
    		tradename.style.visibility = "hidden";
    		eligname1.style.visibility = "hidden";
    		eligidno2.style.visibility = "hidden";
    		tradeno.style.visibility = "hidden";
    		tradename.style.visibility = "hidden";
    		eligname2.style.visibility = "hidden";
        } else {
    		// for company
    		regidtype2.style.visibility = "hidden";
    		regidno.style.visibility = "hidden";
    		abnacn.style.visibility = "hidden";
    		regidtype1.style.visibility = "hidden";
    		regidno1.style.visibility = "hidden";
    		// for other combo box options
    		assocno.style.visibility = "hidden";
    		regidno2.style.visibility = "hidden";
    		eligidtype2.style.visibility = "hidden";
    		eligidno1.style.visibility = "hidden";
    		abnacnbn.style.visibility = "hidden";
    		eligidtype1.style.visibility = "hidden";
    		eligidno1.style.visibility = "hidden";
    		eligname1.style.visibility = "hidden";
    		tradename.style.visibility = "hidden";
    		eligname1.style.visibility = "hidden";
    		eligidno2.style.visibility = "hidden";
    		tradeno.style.visibility = "hidden";
    		tradename.style.visibility = "hidden";
    		eligname2.style.visibility = "hidden";
        }

    Code:
    <select name="eligibilitytype" id="eligibilitytype" onchange="dropdown1();">
                <option value="none" selected="selected">-- Please select --</option>
                <option value="Commercial Statutory Body">Commercial Statutory Body</option>
                <option value="Company">Company</option>
                <option value="Incorporated Association">Incorporated Association</option>
                <option value="Partnership">Partnership</option>
                <option value="Pending TM Owner">Pending TM Owner</option>
                <option value="Registered Business">Registered Business</option>
                <option value="Sole Trader">Sole Trader</option>
                <option value="Trademark Owner">Trademark Owner</option>
              </select>
    <div class="regidtype2" id="regidtype2">Registrant ID Type:</div><br />
    <div class="regidno" id="regidno">Registrant ID Number:</div><br />
    <div class="eligidtype1" id="eligidtype1">Eligibility ID Type:</div><br />
    <div class="eligidno1" id="eligidno1">Eligibility ID Number:</div><br />
    <div class="eligidname1" id="eligidname1">Eligibility ID Name:</div>
    <select name="regidtype1" id="regidtype1" style="visibility: hidden" >
                <option value="ABN" selected="selected">ABN</option>
                <option value="ACN">ACN</option>
              </select>
              <br />
    <input name="regidno1" id="regidno1" type="text" style="visibility: hidden" /> <span class="abnacn" id="abnacn">(ABN / ACN)</span>
    <input name="regidno2" id="regidno2" type="text" style="visibility: hidden" /> <span class="assocno" id="assocno">(Association Number)</span>
    <select name="eligidtype2" id="eligidtype2" style="visibility: hidden">
      <option value="ABN">ABN</option>
      <option value="ACN">ACN</option>
      <option value="ACT BN">ACT BN</option>
      <option value="NSW BN">NSW BN</option>
      <option value="NT BN">NT BN</option>
      <option value="QLD BN">QLD BN</option>
      <option value="SA BN">SA BN</option>
      <option value="TAS BN">TAS BN</option>
      <option value="VIC BN">VIC BN</option>
      <option value="WA BN">WA BN</option>
    </select><br />
    <input name="eligidno1" id="eligidno1" type="text" style="visibility: hidden" /> <span class="abnacnbn" id="abnacnbn">(ABN / ACN / BN)</span>
    <input name="eligname1" id="eligname1" type="text" style="visibility: hidden" /> <span class="tradename" id="tradename">(Trademark Name)</span>
    <input name="eligidno2" id="eligidno2" type="text" style="visibility: hidden" /> <span class="tradeno" id="tradeno">(Trademark Number)</span><br />
    <input name="eligname2" id="eligname2" type="text" style="visibility: hidden" />

  2. #2
    SitePoint Evangelist
    Join Date
    Jul 2007
    Posts
    345
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Is "company" the only value you test for?

    if (a == "Company") {}
    else {}

    Or is that test followed by others?

    if (a == "Company") {}
    else {}
    if (a == "Partnership") {}
    else {}

  3. #3
    SitePoint Evangelist cturner01's Avatar
    Join Date
    Jun 2006
    Location
    My computer
    Posts
    408
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Throughout my code it looks like this: if (a == "Company") {} else {}, etc. For more code just click here.


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
  •