setFocus

Sets the keyboard focus to the form object specified by the reference syntax expression.

It is available only for client applications.

When the param1 argument is omitted or null, setFocus performs a clear focus operation. If any form object has the input focus, the focus is removed from that object and any pending edits in that object are committed, dirtying the document if appropriate. If committing the changes causes a validation error, that error is displayed. If no form object has the input focus, the zero-argument setFocus does nothing.

You cannot use setFocus with the form:ready , layout:ready , or initialize events.

Syntax

Reference_Syntax.setFocus( OBJECT param ) 
Reference_Syntax.setFocus( STRING param ) (deprecated) 

Parameters

param

(Optional) A valid string representing a fully qualified reference syntax expression for the form object.

Returns

Empty

Applies to

Version

XFA 2.6

XFA 2. 1 (deprecated)

Examples

JavaScript

xfa.host.setFocus(xfa.form.form1.TextField1);

FormCalc

xfa.host.setFocus("xfa.form.form1.TextField1")

// Ethnio survey code removed