Hello I am trying when pressing a button to retrieve value from JSF input text to Javascript variable and make an alert with it.
This is what I`ve tried
XHTML CODE:
<b:form id="formIstoricBilant">
                       <b:inputText id="cui"  label="CUI" required="true"  />
                       <b:commandButton value="Trimite" look="primary" onclick="apelIstoricBilant()"/>
                   </b:form>
and this is the Javascript code:
function apelIstoricBilant() {    
    cnp = document.getElementById('formIstoricBilant:cui').value;
    alert(cnp);
}
The alert is working but it is displaying undefined. How can I get the input value?
Thanks
 
    