p:commandButton get executed when explicitly focused

UI Components for JSF
Post Reply
evillalona
Posts: 11
Joined: 09 Jan 2011, 14:44

06 Feb 2011, 01:41

Please i need some help on focus controlling without the p:focus component. Im doing it pretty well with javascript
function setfocus(a_field_id) {
jQuery(PrimeFaces.escapeClientId(a_field_id)).focus();
}
or
function setfocus2(a_field_id) {
document.getElementById(a_field_id).focus;
}
Except with p:commandButton. When i explicitly set the focus in this line: <h:inputText id="itText" onkeypress="setfocus('frMain:cbCreate');"/> to a commandButton like this:
<p:panel id="paButtons">
<p:commandButton value="Create" ajax="true" id="cbCreate" actionListener="#{buttonsBean.buttonsActions}" disabled="#{!buttonsBean.btnCreate}" update="frMain:paButtons">
<f:param id="prCreate" name="btnOption" value="Create"/>
</p:commandButton>
</p:panel>

the commandButton get executed and i just want it focused.
Any help will be appreciated.
Netbeans 12
Primefaces Elite 8.0.6
Java EE 8
OpenJDK 13
apache-tomee-plume-8.0.0

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 24 guests