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 - Spring Data JPA: Why findOne(id) executing delete query internally? -

python - Mongodb How to add addtional information when aggregating? -

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