2010-10-20 4 views
0

J'ai deux champs de saisie de sélection dans une page jsp. Je veux désactiver la deuxième entrée basée sur la valeur de la première entrée. J'ai écrit la fonction. mais ça ne marche pas, aidez-moi.désactiver une entrée sellect basée sur une autre entrée de sélection dans la page jsp en utilisant javascript

function selectTimePeriod() 
{ 

var rtype = document.getElementById('customer.customerType').value; 
var corporateSize = document.getElementById("customer.corporateSize").value; 

if(rtype == "PRS") 
    { 
    document.getElementById("corporateClient").style.display = 'none';  
    document.getElementById("prjClient").style.display = 'none';  

    document.getElementById("prsClient").style.display = ''; 
    corporateSize.disabled=true; 
    } 

} 

les champs d'entrée sont les suivants:

  <td> 
      <html:select property="customer.customerType" styleId="customer.customerType" onchange="selectTimePeriod()"> 
       <% 
        for (index6 = 0; index6 < Constants.customerTypeConstants.length; index6++) 
        { 
       %> 
         <html:option value="<%=Constants.customerTypeConstants[index6][0]%>"><%=Constants.customerTypeConstants[index6][1]%></html:option> 
       <%   
        } 
       %> 
      </html:select> 
     </td> 

    </tr> 

    <tr > 
    <td><label class="desc"><bean:message key="label.customer.corporateSize"/></label></td> 
     <td> 
      <html:select property="customer.corporateSize" styleId="customer.corporateSize"> 
       <% 
        for (index6 = 0; index6 < Constants.corporateSizeConstants.length; index6++) 
        { 
       %> 
         <html:option value="<%=Constants.corporateSizeConstants[index6][0]%>"><%=Constants.corporateSizeConstants[index6][1]%></html:option> 
       <%   
        } 
       %> 
      </html:select> 
     </td> 

Répondre

1

ce qui est l'identifiant pour votre 2ème menu déroulant? essayez cette déclaration

document.getElementById('<id of 2nd dropwon>').disabled = 'true';  
Questions connexes