onUnknownAttributeMessage()

onUnknownAttributeMessage()

This function is called when an attribute is unknown and a validator error message is about to be generated; this function can be used to ignore unknown attributes and/or to change or display additional messages when certain unknown attributes are used. The following variables are defined when this function is called and may be modified before the validator message is displayed: (New v10.9912)

$ouam_attname - the name of the unknown attribute

$ouam_msgtext - the message text of the validator message that will be generated

$ouam_msgtextappend - an additional message that is appended to the end of $ouam_msgtext

$ouam_msgtextprepend - an additional message that is prepended to the front of $ouam_msgtext; the default is an empty string

$ouam_msgcat - the message category (as a string) of the validator message that will be generated

the default is the empty string "" for no category

as of 2019/v19 this can also be set in this function to a category number (integer) in addition to a category string

$ouam_msgflags - the message flags value used when calling MessageEx() to generate the message; set to 0 to cancel the message

$ouam_msgid - the message ID of the validator message that will be generated; the default is -1 for no message ID

$ouam_msgtype - the message type of the validator message that will be generated; the default is $MSG_ERROR

Example

function onUnknownAttributeMessage() {
 if $ouam_attname=="aria-role" {
  $ouam_msgtextappend='Perhaps this attribute should be "role" instead of "'+$ouam_attname+'"?';
 }
 elseif $ouam_attname=="aria-labeledby" {
  $ouam_msgtextappend='Perhaps this attribute should be "label-labelledby"? "'+$ouam_attname+'" is a common misspelling.';
 }
}