Chapter 13. Custom Validation

Table of Contents

Custom Validation for the Store Front
Configuring validation on data entered through the UI
Configuring validation for Custom Fields
Custom Validation for the Admin Application
CustomValidaton.properties file
Fields Supported by Custom Validation

Configuring the Validation used in KonaKart.

Custom Validation for the Store Front

This section defines how you configure the custom validation for the KonaKart application

Configuring validation on data entered through the UI

The configuration is done via an xml file called WEB-INF/validation.xml. There is a section near the top of the file containing all of the parameters that can be customized, with names that describe the actual entry field. e.g.


<constant>
  <constant-name>ENTRY_FIRST_NAME_MIN_LENGTH</constant-name>
  <constant-value>2</constant-value>
</constant>

Note that in order for modifications to take effect, the KonaKart application must be rebooted.

Configuring validation for Custom Fields

As for other data entered through the UI, validation for custom fields is set in WEB-INF/validation.xml . The file contains an example for a custom field where the minimum length is set to 5.


<field property="customerCustom1" depends="minlength">
    <arg0 key="register.customer.body.custom1"/>
    <arg1 name="minlength" key="${var:minlength}" 
          resource="false"/>
        <var>
            <var-name>minlength</var-name>
            <var-value>5</var-value>
        </var>
</field>