This content has been marked as final.
Show 4 replies
-
1. Re: set focus to element
ma.aqcon Oct 30, 2008 5:45 AM (in response to cremersstijn)Check this out
http://mkblog.exadel.com/?p=146 -
2. Re: set focus to element
cremersstijn Oct 30, 2008 7:32 AM (in response to cremersstijn)I have some questions about that focus attribute:
- how can i set the focus to an element when the page is loaded (so when an h:commandbutton is pressed an the page is refreshed.
- i want to use it with modalpanel, so when i click a button to open to panel and make it visible, i want to set the focus to an element on that modalpanel, but IE gives an javascript error that the focus can't be set. -
3. Re: set focus to element
nbelaevski Oct 30, 2008 8:59 PM (in response to cremersstijn)"stijncremers" wrote:
- how can i set the focus to an element when the page is loaded (so when an h:commandbutton is pressed an the page is refreshed.
Try:<f:view> <html xmlns="http://www.w3.org/1999/xhtml"> <body onload="#{rich:element('textInput')}.focus()"> <h:form id="form"> <h:inputText value="" id="textInput"/> </h:form> </body> </html> </f:view>
"stijncremers" wrote:
- i want to use it with modalpanel, so when i click a button to open to panel and make it visible, i want to set the focus to an element on that modalpanel, but IE gives an javascript error that the focus can't be set.
Use "onshow" handler of modal panel to set focus.
P.S. AJAX components have special "focus" attribute to point to the component you wish to give focus to... -
4. Re: set focus to element
cremersstijn Oct 31, 2008 3:42 AM (in response to cremersstijn)I think it works, but i can't test it due to a bug (i think) in the modalpanel:
see http://www.jboss.com/index.html?module=bb&op=viewtopic&t=144786
The modalpanel always hides itselfs when i do a ajax action on the modalpanel