Javascript: Making a textbox display if a dropdown option is selected
<p>Here's a screenshot of what I'm trying to accomplish:
<img src="http://i.stack.imgur.com/iszN9.jpg" alt="enter image description here"></p>

<p>Basically, if the user chooses "SFTP", a textbox should be displayed.</p>

<p>Here's the code I have:</p>

<pre><code>&lt;strong class="heading"&gt;Image Hosting&lt;/strong&gt;
&lt;div id="imagehosting"&gt;
    &lt;form name="test"&gt;
        Does the client require our company to host their images? &lt;br /&gt;
        &lt;em&gt;If you select this option, you'll have to specify what they will be using&lt;/em&gt;
        &lt;input type="checkbox" name="category_level" onchange="categorychanged(this.checked)" /&gt;

        &lt;select name="category_parent" style="display:none" onchange="if(this.selectedIndex==SFTP){this.form['box'].style.visibility='visible'}else {this.form['box'].style.visibility='hidden'};"&gt;
            &lt;option value="1"&gt;Library&lt;/option&gt;
            &lt;option value="2"&gt;SFTP&lt;/option&gt;
        &lt;/select&gt;
        &lt;input style="visibility:hidden;" type="text" name="box"&gt;
    &lt;/form&gt;
&lt;br /&gt;
&lt;/div&gt;
</code></pre>

<p>The function, "categorychanged", is handled by the following Javascript code:</p>

<pre><code>&lt;script language="JavaScript" type="text/javascript"&gt;
&lt;!--
function categorychanged(enable) 
{
    if (enable) 
    {
        document.test.category_parent.style.display="block";
    }
    else 
    {
        document.test.category_parent.style.display="none";
    }
}
//--&gt;
&lt;/script&gt;
</code></pre>

<p>Right now, if I choose "SFTP", nothing happens. The first part works fine, i.e. dropdown displayed when the checkbox is selected.</p>

<p>What am I doing wrong here?
Thanks</p>
