Export (0) Print
Expand All

DataDOMEvent.NewValue Property

Office 2007
A read-only property that returns a string value indicating the value of an XML Document Object Model (DOM) node that is being updated or inserted during a data validation event. Read-only

Version Information
 Version Added:  InfoPath 2003

Syntax

expression.NewValue

expression   An expression that returns a DataDOMEvent object.

Return Value
Variant

Remarks

The NewValue property contains the value of the XML DOM node that will replace the existing value. To get the original value of the XML DOM node, use the OldValue property of the DataDOMEvent 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 NewValue property of the DataDOMEvent object is used to determine whether the new value of the XML DOM node is an empty string. If it is not, the code sets other fields to be empty strings.

JScript
function msoxd__Employees_EmployeeID_attr::OnAfterChange(eventObj)
{
   if (eventObj.IsUndoRedo)
   {
      // An undo or redo operation has occurred and the DOM is read-only.
      return;
   }
	
   if (eventObj.NewValue == "")
      return;

   if (XDocument.DOM.selectSingleNode
      ('/dfs:myFields/dfs:queryFields/q:Employees/@FirstName').text != "")
      XDocument.DOM.selectSingleNode
         ('/dfs:myFields/dfs:queryFields/q:Employees/@FirstName').text = "";

   if (XDocument.DOM.selectSingleNode
      ('/dfs:myFields/dfs:queryFields/q:Employees/@LastName').text != "")
      XDocument.DOM.selectSingleNode
         ('/dfs:myFields/dfs:queryFields/q:Employees/@LastName').text = "";
}



Community Additions

ADD
Show:
© 2014 Microsoft