Primefaces Icarus inputtext setting focus from bean

Post Reply
Posts: 2
Joined: 21 Jun 2017, 22:54

29 Jul 2017, 21:36

I am developing Web POS (Point of sales) using Icarus Theme and a code bar reader "HoneyWell".
I am trying to set focus trough back bean to an inputnumber component once code bar is read. But never control get focus.

Elements used:
- Primefaces 6.1 Community
- Primefaces Icarus Theme.
- HoneyWell Voyager 9520 codebar scanner
-Tomcat 9 M21
- Browser: Chrome 59.0.3071.115 (Build oficial) (64 bits) / FireFox 54.0.1 (64-bits) / Microsoft Edge

Source code resume
1. xhtml

1.1 <h:form id="frmColMan" >
(note: I used <script src=""></script> -as also other jquery versions- changing focus works!, but
some primefaces components like p:selectOneMenu, p:calendar got malfunctions or unexpected behavior)
1.2 <p:focus id="focusID" for="#{vwCodeBar.focusProperty}" /> (note: component recomended for setting focus)
<div class="ui-g-6 ui-lg-6">
<p:inputText id="itBarCode" value="#{vwCodeBar.strCodeBar}" placeholder="Bar code input" tabindex="2"
onkeypress="if (event.keyCode == 13) { onchange(); return false; }">
<p:ajax event="change"
update="valuePay, focusID" />
(note: this code piece for reading bar code input)
trigger: function focusField(){
jQuery( document ).ready(function( $ ) {
return false;
(also used in different several times, but without results
function focusField(){

function focusField(){
function enterToTab(event){
if (event.which === 13) {
event.keyCode = 9;
return false;


2. Java Back bean
public class CodeBar extends Exception {
public CodeBar() {
focusProperty = "itBarCode"; //set focus ok!
//Getting code bar configuration
public void codeBarBreakDown(AjaxBehaviorEvent event){
strValue = strCodeBar.substring(posIni , posFin);
valueToPay = transformToPay(strValue);
RequestContext.getCurrentInstance().update("frmColMan:valuePay"); //does not work or refresh component focus
focusProperty = "valuePay"; //does not work or refresh component focus

As you can see , Javascript and Primefaces is used in order to set focus from backing bean programmatically. But without any success.
Change focus is required for work flow process.

Thanks in advance

Posts: 3
Joined: 01 Jul 2014, 07:00

02 Aug 2017, 07:05

My advice, try to check in your xhtml if you get p:dialog components inside your <h:form> </h:form>. If so, move it all them out side h:form.
Then test again your focus setting.
So long.

Posts: 2
Joined: 21 Jun 2017, 22:54

02 Aug 2017, 17:41

dsalazar: bearing your advice, I moved dialogs and awesomely it works, except on Microsoft Edge. Any ideas why?

Posts: 4569
Joined: 29 Jun 2013, 12:38

04 Aug 2017, 13:10

This isn't an Icarus Layout or Theme issue. Please use core forum; viewforum.php?f=3

Post Reply

Return to “Icarus”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest