jsf 2 - Primefces commandbutton click focus specify id -


i press commandbutton need focus specify id not working in primefaces. try below code:

<h:form id="mainform">     <p:inputtext id="userloginnametextid"/>     <p:inputtext id="passwordtextid"/>      <p:commandbutton id="useraddbutton" value="#{platform.addbutton}"      onfocus="userloginnametextid" action="user.addaction"/> </h:form> 

note: tried below attributes in onfocus

  1. onfocus="#mainform:userloginnametextid"
  2. onfocus="#mainform:userloginnametextid"
  3. onfocus="document.getelementid(mainform:userloginnametextid)"

the onfocus event fire if focus commandbutton (and e.g. execute javascript). not used set focus else.

do realy need set focus input clientside when click button?


Comments

Popular posts from this blog

java - Incorrect order of records in M-M relationship in hibernate -

ruby - Net::HTTP extremely slow responses for HTTPS requests -

c# - Json write can not be serialized -