View.SelectText Method

InfoPath Developer Reference

Selects the text contained in an editable field that is bound to the specified XML Document Object Model (DOM) node.

Version Information
 Version Added:  InfoPath 2003

Syntax

expression.SelectText(pxnField, varViewContext)

expression   An expression that returns a View object.

Parameters

Name Required/Optional Data Type Description
pxnField Required [IXMLDOMNODE] The XML DOM node.
varViewContext Optional Variant The ID of the control that is used for the context, which is an element with the specified view context of "xd:CtrlId".

Return Value
Nothing

Remarks

If a view context is specified, then the editable field that is to be selected must be within that context.

If there are more than one set of view elements which map to the same specified XML DOM node, within the given view context, then the SelectText method will return an error. In addition, if any of the arguments to the SelectText method are null or are not exposed in the view, then the SelectText method will also return an error.

Security Level 2: Can be accessed only by forms running in the same domain as the currently open form, or by forms that have been granted cross-domain permissions.

Example

In the following example, the SelectText method of the View object is used to select a field that is bound to an XML DOM node:

JScript
  var objXMLNode;
objXMLNode = XDocument.DOM.selectSingleNode("/employees/employee/name");
XDocument.View.SelectText(objXMLNode);

See Also