ali
ali

Reputation: 49

set foucs on a feedback component with Apache Wicket

How can I add a focus behavior to a feedback component in a panel?

Searching leads to very little information, mostly on setting the default field. I do not want to set a default field, rather I am looking to set focus

Upvotes: 0

Views: 102

Answers (1)

martin-g
martin-g

Reputation: 17503

You could focus a Component by using AjaxRequestTarget.focusComponent(feedbackPanel).

There are two preconditions for this to work:

  • the HTML element used for the FeedbackPanel has to be focusable, i.e. to have a tabindex attribute
  • the HTML element used for the FeedbackPanel has to have an id attribute (feedbackPanel.setOutputMarkupId(true)), so that Wicket Ajax can look it up and set the focus on it

Upvotes: 0

Related Questions