I have a primefaces(v10) input text which I need to set from a javascript function and also have an ajax event fire on blur. In my code I have this, but have been unsuccessful in getting the ajax function to fire.
<h:form id="myForm">
<p:inputText id="myText" widgetVar="myTextVar" value="#{myBean.myText}">
<p:ajax event="blur" listener="#{myBean.updateMyText}" update="myForm"/>
</p:inputText>
</h:form>
I can set the inputText using:
document.getElementById("myForm:myText").value="The Value"
But I'm wondering if I need to use something from the PF() Widget API?
Its easy. Just use the widget...
PF('myTextVar').jq.val('The Value').trigger('change');