In primefaces 3.0.M3, While using document.getElementById(‘confirmPassword’) for getting textBox value to javaScript, which gives a null value!
Code is:
in primefaces:
<h:outputText value="Confirm Password*" />
<p:password
value="#{employeeRepositoryImpl.securityPrincipals.confirmPassword}"
required="true" label="Confirm Password" id="confirmPassword" for="confirmPassword" onkeyup="check()" >
update="confirmPassword" />
</p:password>
in javaScript:
function check(){
var title1 = document.getElementById('confirmPassword');
var title2 = document.getElementById('password');
alert(title1+title2);}
I have set prependId=”false” . But alert shows null.Any other way to do the same?
As you mentioned, the HTML that is generated is as below
which means still form appends id from it, please recheck your
h:formunder which these components lies and set theprependId="false"and if you try to get the HTML dom with id
confirmPasswordit will returnnullwhere the actual ID in HTML isformId:confirmPassword_input