I want to implement some javas cript in my JSF component, but I have problem with id. My java script with:
document.getElementById("myForm:customerId")
does not work because id is wrong. I have a composite JSF component:
<composite:implementation> <div id="element_customer"> <h2 class="element_title">Customer</h2> <h:form id="myForm"> <h:inputText id="customerId" value="#{cc.attrs.customerId}"/> </h:form> </div> </composite:implementation>
and HTML output:
<div id="element_customer"> <h2 class="element_title">Customer</h2> <form id="j_idt44:myForm" name="j_idt44:myForm" method="post" ... > <input type="hidden" name="j_idt44:myForm" value="j_idt44:myForm" /> <input id="j_idt44:myForm:customerId" ... name="j_idt44:myForm:customerId" /> </form> </div>
Why is "j_idt44" used in the HTML output?
Ziletka
source share