onMessageID_(msgid)()

Replace (msgid) with the actual message ID. This function is called when a message is generated with the specified message ID. For example, use the function name onMessageID_1020715192 if you want the function to be called when a message with message ID 1020715192 is being generated. Messages with no message ID are treated as having a message ID of 0 so that onMessageID_0() will be called. This function can be used to cancel a message or to change it. (New v10.9912)

$omid_cancel - set this to true to cancel the message

$omid_msgid - the message ID of the validator message that is being generated (can be changed)

$omid_msgtext - the message text of the validator message that is being generated (can be changed)

$omid_msgtype - the message type of the validator message that is being generated (can be changed)

NOTE: This function is executed before the message ID configuration is checked.

Be careful not to create infinite recursion problems by causing messages to be generated in this function which will then call this function again (be especially careful when using onMessageID_0()).

In v15 and above, a message with no message ID will cause onMessageID_0() to be called and $omid_msgid will be -1.

Example 1:

This simple example cancels the message a message ID of 2013103103.

function onMessageID_2013103103() {
 $omid_cancel=true;
}

Example 2:

Let's say that you have this HTML: <meta name="customnamevalue" content="customcontent">

... and it's causing this validator message: The name "customnamevalue" specified by the "name" attribute is not recognized. Visit http://www.w3.org/TR/html5/document-metadata.html#standard-metadata-names and http://wiki.whatwg.org/wiki/MetaExtensions for more information.

...and the message's ID is 2013070902. You can get the message ID in the Results Window of the editor by right-clicking on the validator message and hovering the mouse over the Message Options option that appears in the context menu. The message ID will then be displayed in the status bar.

The following user function can be used to cancel this message:

function onMessageID_2013070902() {
 if stripos($omid_msgtext,'"customnamevalue"')>=0 {
  $omid_cancel=true;
 }
}