Tuesday, November 29, 2011

Fixing the focus on the field, post validation on tab out event.

Recently I got a query on how to keep the focus on a text field after the field has been validated on tab out event occurrence. There are two ways to achieve the same as described below. The second one has been preferred by few people.  But I would anyways describe both of them.

1.Declare the validator method in the managed bean (autosubmit set to true, immediate set to true) also apply client listener on the input text. Replicate the validation done in the managed bean in the javascript method and use AdfFocusUtils.focusElementDelayed()  method to lock the focus.

2.In the value change listener if you are not throwing a ValidationException then you might also try calling the javascript method (having use AdfFocusUtils.focusElementDelayed()  method to lock the focus) using the ExtendedRenderKitService to achieve it.

No comments:

Post a Comment