OpenWGA 7.11 - TMLScript reference

TMLForm "tmlform"
Method :

addMessage([fieldName,] msg)

On object TMLForm "tmlform"
Usage Adds a new validation message
Description 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
  • WebTML pages and normal WebTML actions
  • Master actions
Examples 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");
if (!isValidPC(pc)) {
    tmlform.addMessage("The postal code is invalid");
else {