View.Name Property

InfoPath Developer Reference

A read-only property that returns a string containing the name of the view that is represented by the View object. Read-only

Version Information
 Version Added:  InfoPath 2003

Syntax

expression.Name

expression   An expression that returns a View object.

Return Value
String

Remarks

To determine whether a view is the default view, use the ViewInfo object.

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 Name property of the View object is used to determine which view the user has switched to. If the view is the Archive Customer view, a note value is added to the form's underlying XML document:

JScript
  function XDocument::OnSwitchView(eventObj)
{
   var oDate = new Date();

if (XDocument.View.Name == "Archive Customer") { var oNotesNode = XDocument.DOM .selectSingleNode("/Customers/CustomerInfo/Notes"); var oDivNode = XDocument.DOM .createNode(1, "div", "http://www.w3.org/1999/xhtml");

  oDivNode.text = "Note recorded " + oDate.toString();
  oNotesNode.appendChild(oDivNode);

} }

See Also