|On object||TMLForm "tmlform"|
Adds a new validation message
This method adds custom validation messages to the validation result of the WebTML form that are stored on form level (i.e. not specific for a special input field). You can use it if you are performing additional manual validations in TMLScript and want to display their result as normal WebTML form validation message.
fieldName (String, optional):
Name of the form field to assign the message to. If omitted this will be a global message.
msg (String):Message to register
|Allowed in script types||
The following example validates a postal code in TMLScript. Some (undefined) testing function "isValidPC" is called and, if false, a message is added to the WebTML form. This then can be displayed by typical validation display functionalities like <tml:formmessages> and the like:
var pc = tmlform.field("pc");