0

I have the below dropdowns. I need to select the second dropdown (email) when the user select an entry in first dropdown (accounts). if accountid2 is selected, email-id2 must be selected. if other, other should be selected. how to do that using onchange function.

        <td>11.member's&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<br>Account Number:&nbsp <br />
            <span class="bodyCopy"></span> 
        <html:select name="DataForm" property="accountNumber" styleClass="formContent" 
             style="width:80px" >    
           <option value = "0">Other  </option> 
         <c:if test = "${!empty Data.accountId2}">
          <option value = "1">${Data.accountId2}</option>  
        </c:if>
          <c:if test = "${!empty Data.accountId1}">
            <option value = "2">${Data.accountId1}</option>
          </c:if>
           <c:if test = "${!empty Data.accountId3}">
         <option value = "3">${Data.accountId3}</option>
          </c:if>
          <c:if test = "${!empty Data.accountId4 }">
         <option value = "4">${Data.accountId4}</option>
          </c:if>
         <c:if test = "${!empty Data.accountId5}">
         <option value = "5">${Data.accountId5}</option>
          </c:if>
       </html:select> 
        </td>

        <td colspan="3">12. Member's<br>E-mail Address: <br />

        <span class="bodyCopy"  ></span> 

         <html:select  name="DataForm" property="emailAddress" style = "width:150px"
          styleClass="formContent" >    
            <option value = "0">Other  </option> 
          <c:if test = "${!empty Data.primaryEmail2}">
          <option value = "1">${Data.primaryEmail2}</option>  
         </c:if>
          <c:if test = "${!empty Data.primaryEmail1}">
            <option value = "2">${Data.primaryEmail1}</option>
          </c:if>
           <c:if test = "${!empty Data.primaryEmail3}">
         <option value = "3">${Data.primaryEmail3}</option>
          </c:if>
          <c:if test = "${!empty Data.primaryEmail4}">
         <option value = "4">${Data.primaryEmail4}</option>
          </c:if>
         <c:if test = "${!empty Data.primaryEmail5}">
         <option value = "5">${Data.primaryEmail5}</option>
          </c:if>
           </html:select>
        </td>
BenMorel
  • 34,448
  • 50
  • 182
  • 322
RMa
  • 111
  • 2
  • 7
  • 18

1 Answers1

0

Please take a look at Populating Child Dropdown - JSP/Servlets

Community
  • 1
  • 1
Piyush Mattoo
  • 15,454
  • 6
  • 47
  • 56