ReturnMessage Property

Microsoft Office InfoPath

Sets or retrieves a string value indicating the error message that will be returned if the data validation event is not successful.

expression.ReturnMessage

expression    Required. Returns a reference to 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.

Remarks

Used in conjunction with the ReturnStatus property of the DataDOMEvent object, the ReturnStatus property displays a message box to the user with the specified text message.

Example

In the following example, the ReturnMessage property of the DataDOMEvent object is used to display a message to the user if the data validation for the XML DOM node fails:

function msoxd__id_attr::OnBeforeChange(eventObj)
{
   if (eventObj.NewValue == "")
   {
      eventObj.ReturnMessage = "You must supply a value for this field.";
      eventObj.ReturnStatus = false;
      return;
   }
}