Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 446425
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T21:28:10+00:00 2026-05-12T21:28:10+00:00

We are using Richfaces in one of our projects. I need to focus the

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T21:28:10+00:00Added an answer on May 12, 2026 at 9:28 pm

    Use the RichFaces tag function #{rich:clientId( JSF_ID )} to get the appropriate client id for a component. If you need the element inside the DOM tree, you can get it directly with #{rich:element( JSF_ID )}

    Example:
    onclick="#{rich:element('userNameInputBox')}.focus()"

    I believe you need RichFaces 3.2.0 or higher for this to work.

    The documentation on Richfaces JS Interaction functions

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using RichFaces 3.3.3, JSF 1.2 and Facelets. For some presentation purposes I need to
I'm using JSF (Mojarra 1.2) with Richfaces (3.3.2) within some facelets which are used
I'm using a RichFaces commandbutton and I need it to execute two functions on
I'm using RichFaces on my JSF2 application, and I need a way to have
We are using Richfaces 3.3.3.Final. Our problem is about navigation problem on a4j:commandButton .
I'm using RichFaces' a4j:support to toggle the visibility of some controls on the page.
I'm using richFaces 3.3 and JSF 1.2. In my sample application I need to
Using Richfaces 3.3.0GA, jsf 1.2_14 and facelets. I have a richfaces ModalPanel with an
We are using Richfaces 4.1.0, and I am trying to use an extendedDataTable. I
I'm using Richfaces JSF and I want to iterate over an Map<Object,Object> . I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.