IBM BPM, V8.0.1, All platforms > Create processes in IBM Process Designer > Create user interfaces for business processes > Building Heritage Coaches > Configure Heritage Coach controls

Use validation scripts for button controls

Add validation scripts for button controls to ensure that users provide all required input.

When building Heritage Coaches in IBM BPM, you can add client-side validation scripts for button controls. Validation scripts ensure that users provide all required input. If not, the script provides the appropriate feedback to prompt users for the required information.


Procedure

  1. Open the service that contains the Heritage Coach that you want to work with and then click the Coaches tab.

  2. In the design area, click to select the control for which you want to add a validation script.

  3. Click the Presentation option in the properties.

  4. If multiple buttons are included in the control, under Buttons, click the button that needs the validation script.

  5. In the text box under the Validation Script section, type the JavaScript to validate that the required controls have been set and contain values as expected. To do this, use the control ID of each required control. The following example is client-side JavaScript that uses the default controls included when you add a new Heritage Coach to a service. The following validation script checks to ensure that the check box is enabled (set to true). If not, the user is prompted to check it before proceeding by clicking OK.
    if ( document.getElementById("checkbox0_checkbox").checked == true ){
      return true;} else {
      alert( "Check the checkbox");
      return false;}
  6. Save the Heritage Coach and then run the service to test the script.


What to do next

In many cases, an OK or Submit button that runs a validation script on the user input is accompanied by a Cancel button which discards the user input. When Is Cancel is selected for a button, clicking the button discards any changes to variable values, and moves the token to the next step in the flow.

Configure Heritage Coach controls


Related tasks:
Use a custom script to control visibility