View Source

h2. Focus Retention API

The Focus Retention API allows developers direct access to ICEfaces' focus retention mechanism. Focus retention is used to ensure that the appropriate element receives focus after an ajax DOM update is applied.

The following Focus APIs are available:

* *{{[ice.applyFocus(id) _or_ ice.af(id)|#applyFocus]}}*
* *{{[ice.setFocus(id) _or_ ice.sf(id)|#setFocus]}}*

----
\\
{anchor:applyFocus}
{panel}
h4. ice.applyFocus(id) or ice.af(id)

Accepts an element ID. By calling this function the client will move the focus on the specified element and also call ice.setFocus so that the server will be informed about the focus change.

_Usage:_

{code:javascript}ice.applyFocus(id);
{code}
{_}Parameters:_

* id
bq. The ID of the element.
{panel}
\\
{anchor:setFocus}
{panel}
h4. ice.setFocus(id) or ice.sf(id)

Accepts an element ID. By calling this function the client will send the ID to the server next time a form submit is invoked. The focus is not moved on the specified element.

_Usage:_

{code:javascript}ice.setFocus(id);
{code}
{_}Parameters:_

* id
bq. The ID of the element.
{panel}