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

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -