We are using Richfaces in one of our projects.
I need to focus the element dynamically on some user action. The issue here is I only have the id (JSF specific id that I give to element.)
For example: for h:inputText
I use it as
<h:inputText id="userNameInputBox" value="<<some binding>>/>
and this input box is embedded in separate form. When I include the input box in form, the id of the input box will be: formName:userNameInputBox (<<formName>>:<<elementId>>)
I will be re-using the input box in multiple JSPs. That means, I do not know the parent form in which I will include the input box.
Now, I need to focus() the input box. Currently I am not able to do this as I do not have the actual generated id (<<formname>>:<<elementId>>
) but I only have the JSF specific id I gave.
How can I make focusing the element work?