OpenWGA 7.10 - TMLScript reference

WGA
Object:

WGA.Validate

Description

This subobject offers comfortable functions to validate data in common ways, prominently in WebTML form validations.

The methods of this object that have no parameters are to be used within WebTML field validation expressions (<tml:input> attribute validation) and automatically test the current field.

Retrieval Global object WGA.Validate
Allowed in script types
  • WebTML pages and normal WebTML actions
  • Master actions
  • TMLScript tasks in jobs
  • Content type events
Properties and methods
Name Purpose
isDateInFuture([date]) Tests if the date is a valid date in the future
isDateInPast([date]) Tests if the date is a valid date in the past
isEmpty([fieldname]) Returns if the WebTML form field is empty
isFilled([fieldname]) Returns if a WebTML form field is filled
Examples

Some examples of using WGA.Validate inside WebTML form validation functions for common cases:

Name:

<tml:input name="name" validation="WGA.Validate.isFilled()" message="Please enter a name"/>


<br>


Date of birth:

<tml:input name="dateofbirth" type="date" validationdivider="~"

  validation="WGA.Validate.isFilled() ~ WGA.Validate.isDateInPast()

  message="Please enter a date of birth ~ Your date of birth must be in the past"/>


<br>


Company:

<tml:input name="company" type="select" relationtype="protected" 

  validation="WGA.Validate.isFilled()" message="Please specify a company"/>