Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JSF2 Focus on field and JavaScript injection from code  RSS feed

Piotr Wieczorek
Posts: 1
Java Linux Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone!
I'v been looking for the solution how to get focus on the text input field all day long.
Previously i was using Jsf1.2 with icefaces, and JavaScriptContext.addJavaScriptCall("document.getElementById('form:inputfield').focus()") did the job but now i'm using only JSF2 (mojarra) with primefaces, and there is now JavaScriptContext class.
So my questiona are:
how in JSF2 make focus on field (preferably without javascript)
and how to include in jsf2 javascript code from java bean (not the js from external file but simply js as a string)?
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!