# Name Property (View Object)

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

expression.Name

expression Required. An expression that returns a reference to the View 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.

## Remarks

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

## Example

In the following example from the Events developer sample form, 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:

    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);
       }
    }

©2003-2004 Microsoft Corporation. All rights reserved. Permission to copy, display and distribute this document is available at: http://msdn.microsoft.com/library/en-us/odcXMLRef/html/odcXMLRefLegalNotice.asp