show/hide form elements on the basis of dropdown value
<p>I have a requirement that I have a form in which some fields are mandatory and some are not.I have a drop down in my form having two condition first is "show all fields" and another is "show only mandatory fields" now what I want to do is that when user selects "show all fields" than all fields are shown and when user selects "show only mandatory fields" then only mandatory fields will be shown.</p>

<pre><code>&lt;form:form method="POST" action="addCountry.htm" commandName="countryForm" id="countryForm"&gt;
    &lt;table&gt;

    &lt;tr&gt;
        &lt;td&gt;Select fields:&lt;/td&gt;
        &lt;td align="center"&gt;
            &lt;select name="fields"&gt;
                &lt;option value="non mandatory"&gt;show all fields&lt;/option&gt;
                &lt;option value="mandatory"&gt;show only mandatory fields&lt;/option&gt;
            &lt;/select&gt;
        &lt;/td&gt;
    &lt;/tr&gt;

        &lt;tr&gt;
            &lt;td&gt;Country Name :&lt;/td&gt;
            &lt;td&gt;&lt;form:input path="countryName"/&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td&gt;Country ISD Code  :&lt;/td&gt;
            &lt;td&gt;&lt;form:textarea path="countryISDCode" /&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td&gt;Nationality :&lt;/td&gt;
            &lt;td&gt;&lt;form:textarea path="nationality"/&gt;&lt;/td&gt;
        &lt;/tr&gt;

        &lt;tr&gt;
            &lt;td colspan="3"&gt;&lt;input type="submit" value="submit"/&gt;&lt;/td&gt;
        &lt;/tr&gt;
    &lt;/table&gt;
&lt;/form:form&gt;
</code></pre>

<p>Take this form as a example in which country name and country ISD code is mandatory and nationality is not mandatory.Now on the basis of drop down selection I want to show these fields.</p>

<p>Regards
Brajesh</p>
