Show TOC

Procedure documentationValidating General Properties Locate this document in the navigation structure

 

The Wizard Framework provides an IObjectValidator component for validating data entered on the General Properties pane. The following is checked:

  • The object name and ID are in the correct format. For example, values must not exceed a maximum length and must contain only specific characters.

  • No object exists with the same object ID and prefix in the selected object.

Procedure

  1. Add an IObjectValidator component usage, as follows:

    1. Right-click Used Components and select Add Used Component. The New Web Dynpro Component Usage dialog box opens.

    2. In the Name field, enter IObjectValidator.

    3. Next to the Used Web Dynpro Component field, click Browse and select IObjectValidator.

    4. Click Finish.

  2. In the IWizard window's Properties view, add the IObjectValidator component interface controller as a required controller.

    The component usage is already added.

  3. Add the following code to the IWizard window's wdDoInit() method:

    Syntax Syntax

    1. wdThis.wdGetIObjectValidatorComponentUsage().createComponent(
          WizardFWAPIInfo.OBJECT_VALIDATOR_NAME,
          WizardFWAPIInfo.OBJECT_VALIDATOR_NAMESPACE);
    End of the code.
  4. In the doBeforeNext() method, if the current pane is the General Properties pane, validate the input by calling the isValid() method on IObjectValidator.

    Return true if the input is valid, false if the input is not valid, as follows:

    Syntax Syntax

    1. public booleandoBeforeNext( )  {
        //@@begin doBeforeNext()
        if (wdContext.currentContextElement().getPaneNumber()==1) {
            IWDComponentUsage usage = wdContext
                .currentWizardFWNodeElement().getParamsHolderComponentUsage();
            return wdThis.wdGetIObjectValidatorInterface().isValid(usage);
        }
        return true;
        //@@end
      }
      
    End of the code.

Result

If invalid data is entered, an error message is displayed and the wizard does not navigate to the next pane.

This graphic is explained in the accompanying text.