Roman
Roman

Reputation: 1019

Howto set focus in Rich Faces panelBarItem?

Hi I want to set focus on <h:inputText> element whenever rich:panelBarItem is opened. I have:

<rich:panelBar>
   <rich:panelBarItem onenter="setFocus();">
      <h:inputText value="#{bean.value}"/>
   </rich:panelBarItem>   
</rich:panelBar>

it works fine when I open it with mouse click, but does not work first time when first panelBarItem is automatically opened. How should I set focus on first opened panelBarItem? I really would like it to be some event(I could not find) on rich:panerBarItem or rich:panelBar.

Upvotes: 0

Views: 867

Answers (1)

zinan.yumak
zinan.yumak

Reputation: 1590

You can call your method after page load to set focus to field. Something like

<script>
//call after page loaded
window.onload=setFocus(); 
</script>

or

<body onload="setFocus();">

Upvotes: 1

Related Questions