Tutorial: Adding a validation rule in the Marketing tool
This tutorial demonstrates how to add a new validation rule for the start and end dates of Web Activities in the Marketing tool. A validation rule is used to ensure that the activity is active for at least 10 days. If the user enters a start date and an end date that are not at least 10 days apart, a validation error is displayed. The new rule is implemented on both the Management Center client and the WebSphere Commerce Server side. This ensures that the dates are validated, regardless of how they are created in the activity (by way of the Management Center or any client that interfaces with the server).
Learning objectives
- Understand how to add a validation rule.
Time required
Expect this tutorial to take about two hours to complete.You can download the completed tutorial code for this tutorial for the reference:
- Download the completed tutorial code for WebSphere Commerce v7 and Feature Pack 1.
- Download the completed tutorial code for WebSphere Commerce v7 Feature Pack 2.
However, in order to fully attain the learning objectives, it is recommended that you perform the tutorial step by step.
Skill level
Advanced
Audience
This tutorial is intended for Management Center developers.
System requirements
Before beginning this tutorial ensure that you have fulfilled the following prerequisites:
- Installed WebSphere Commerce Developer
Prerequisites
Before beginning this tutorial ensure that you have fulfilled the following prerequisites:
- Familiarity with WebSphere Commerce Developer
- An understanding of the Java programming language
- A basic understanding of XML
Lessons in this tutorial
- Add a new validation rule for a Web activity on the OpenLaszlo client side
In this step, we will add a new validation rule for a Web activity in the Management Center. The validation rule will display an error message if the web activity is not set to be active for 10 days, by comparing the start and end dates.
- Add a new validation for the server side
In this step, we will add a new validation on the server side.
- Display the server side error message
In this step, we will map the server side error message to the client side property to display the error message.
- Test the customization
In this step, you test that the customization was successful.
- Deploy the customized code
Once the customization has been completed and tested, you are ready to deploy the custom code to a target WebSphere Commerce Server and implement the customization on a live site. Deploying to the server involves exporting code from the WebSphere Commerce development environment and deploying code into the target WebSphere Commerce Server.