title: Enable/Disable SelectOneMenu of primefaces using Java Script
body: <p>I am new to JSF and Primefaces.
  I am building a xhtml page in which i have two selectonemenu of primefaces.I wanted to enable or disable second selectonemenu depending on the value selected by user in first selectonemenu.
  For enable/disable i wrote Java Script in the page as i wanted to do it at client side, but i dont know how to call java script function in the primefaces component.</p>
  
  <p>Code Sample</p>
  
  <pre><code>        &lt;h:head&gt;
          &lt;style type="text/css"&gt;
      .ui-widget,.ui-widget .ui-widget {
          font-size: 12px !important;
      }
      &lt;/style&gt;
          &lt;script&gt;
              function disableOneMenu() {
                  alert("In Disable One Menu Function...");
                  var clickedGroup = document.getElementById('groupOneMenu').value;
                  alert("Selected Value " + clickedGroup);
                  if (clickedGroup == "Designation") {
                      document.getElementById('designation').disabled = true;
                      alert("Location One Menu Disabled...");
                  } 
              }
          &lt;/script&gt;
          &lt;link type="text/css" rel="stylesheet"
              href="#{request.contextPath}/themes/redmond/skin.css" /&gt;
      &lt;/h:head&gt;
      &lt;h:body&gt;
          &lt;h:form&gt;
              &lt;p:layout fullPage="true"&gt;
                  &lt;p:layoutUnit position="north" size="30"
                      header="HCV : Peer Group Analysis" resizable="true"&gt;
                  &lt;/p:layoutUnit&gt;
                  &lt;p:layoutUnit id="contentLayout" position="west" size="200"&gt;
                      &lt;h:panelGrid columns="2"&gt;
                          &lt;h:outputText value="Analyse for values of attribute: " /&gt;
                          &lt;p:selectOneMenu id="groupOneMenu" value="#{userInput.groupAttr}"
                              style="font-size:18;font-weight:bold;color:blue;width:100"&gt;
                              &lt;f:selectItem itemLabel="Select One" itemValue="" /&gt;
                              &lt;f:selectItems value="#{userInput.groupAttrList}" /&gt;
                              &lt;p:ajax event="valueChange" actionListener="disableOneMenu" /&gt;
                          &lt;/p:selectOneMenu&gt;
                          &lt;h:outputText value="Designation: " /&gt;
                          &lt;p:selectOneMenu id="designatinoOneMenu"
                              value="#{userInput.designation}"
                              style="font-size:18;font-weight:bold;color:blue;width:100"&gt;
                              &lt;f:selectItem itemLabel="Select One" itemValue="" /&gt;
                              &lt;f:selectItems value="#{userInput.designationList}" /&gt;
                          &lt;/p:selectOneMenu&gt;
                         &lt;/h:panelGrid&gt;
              &lt;/p:layoutUnit&gt;
          &lt;/p:layout&gt;
      &lt;/h:form&gt;
  &lt;/h:body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Please help, hw can i use java script in xhtml page..</p>
  
  <p>Thanks..</p>