When a user views a promotion, the PromotionTemplateManager determines whether the template is valid for that promotion.

If the template fails validation but can still be parsed, Oracle ATG Web Commerce Merchandising may provide an opportunity to open the promotion using the Advanced Condition and Offer page (see the ATG Merchandising Guide for Business Users). If the Advanced Condition and Offer is unable to display the template, Merchandising displays the raw PMDL.

When a user creates a new promotion from a template, the promotion is validated through a combination of client-side and server-side activities. In addition to that validation, you can restrict the text users can enter in a field. For textInput and textArea elements, you can use the following attributes to limit user input:

  • maxChars – limits the number of characters that can be typed in the field

  • restrict – indicates the set of characters that a user can enter. If the restrict attribute is a string of characters, the user can only enter those characters into the field. You can specify ranges using a hyphen. Use a double backslash to include characters such as ^, - and \. For example, the following code allows the user to enter a dash ( - ) in the textInput:


    The restrict attribute maps to the Flex restrict object, and supports standard Flex functionality.

You can also associate a user interface element with a Nucleus validator component, using the validator attribute in the ui-description element. The Nucleus component performs the validation when the user clicks OK on the completed Condition and Offer popup.

Each user interface component type has its own validator, but you can use a single validator for multiple UI element types. The validator is passed the type of element the information came from, the information that was supplied by the user and the id of the field it came from. The field id uniquely identifies the user interface element to be validated.

If validation and any subsequent translation are successful, a PropertyState object containing the promotion properties is returned. If some validation failed, then an error string is passed back to the user interface inside the PropertyState object, to be associated with the user interface element failing validation. The promotion itself is not created or saved at this time.

By default, Oracle ATG Web Commerce includes the following validator components in the atg.remote.promotion.template.validators package:

  • BandedDiscountValidator

  • Number Validator

  • RegexValidator

The RegexValidator includes several preconfigured variations that can check for the following patterns:

  • DecimalValidator—Match any positive floating point number, includes zero


  • DollarValidator—Match any dollar amount to two decimal places, includes zero


  • NonZeroDecimalValidator—Match any positive floating point number, excludes zero


You can extend the provided validation framework by adding your own validators. Custom validators must implement the atg.remote.promotion.template.contentSource.java interface; see the ATG Platform API Reference for details.

Copyright © 1997, 2012 Oracle and/or its affiliates. All rights reserved. Legal Notices