Application
How do I configure validation on data entered through the application UI ?How can I add validation to a custom field ?
Admin App
How do I change the field validation in the KonaKart Admin App ?Which fields can I define validation rules for in the Admin App ?
how do i configure validation on data entered through the UI ?
This process works differently to the osCommerce implementation. In osCommerce there are many configuration parameters beginning with ENTRY_ (i.e. ENTRY_FIRST_NAME_MIN_LENGTH) that configure the validation for entered data. KonaKart does not use these parameters. Instead 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 identical to the osCommerce configuration properties. 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.
How can I add validation to a custom field ?
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>
How do I change the field validation in the Konakart Admin App ?
From release 2.2.3.0 of KonaKart it is possible to modify the default field validation in certain parts of the Admin App.
A new properties file is provided, called CustomValidation.properties. You will find this in the classes directory of the konakartadmin webapp.
The format and description of this file is defined within the file itself, but an extract is as follows:
| # -------------------------------------------------------------------- # # K O N A K A R T C U S T O M V A L I D A T I O N # # -------------------------------------------------------------------- # The parameters to define custom validation in the KonaKart Admin App # -------------------------------------------------------------------- # -------------------------------------------------------------------- # If no custom validations are defined (or this file is removed) the # default validation rules are used in the KonaKart Admin App. # # If you define custom validations in this file they will override # the default rules defined in the KonaKart Admin App. # Therefore, you only need to define the custom validation rules # that are different to the defaults. # -------------------------------------------------------------------- # -------------------------------------------------------------------- # If your intention is to increase the number of characters allowed # in the database for a certain quantity, you will have to modify the # characteristics of that column in the database first. If you then # wish to validate the attribute in the KonaKart Admin App to allow # for the increased column width... you also need to add your custom # validation to this file # -------------------------------------------------------------------- # -------------------------------------------------------------------- # Format: # # ClassName.Attribute = [min];[max] # # If min or max are not specified they will not be checked. # |
Therefore, if you wanted to change the validation on the Product SKU field in the Admin App, you would specify:
Product.sku = 1;18 |
Which fields can i define the validation for ?
Only a certain subset of fields can have their validation overridden in this way, but if you need other fields to be made available for validation please get in touch with support at KonaKart.
Currently you can define validation rules for the following fields:
Product.contentType Product.custom1 Product.custom2 Product.custom3 Product.custom4 Product.custom5 Product.description Product.quantity Product.model Product.name Product.sku Product.weight |
All of these fields appear (commented out) in the default CustomValidation.properties file in the default installation for ease of reference.
If you have questions on customizing KonaKart please post these on our forum.

