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.
Add an IObjectValidator component usage, as follows:
Right-click Used Components and select Add Used Component . The New Web Dynpro Component Usage dialog box opens.
In the Name field, enter IObjectValidator .
Next to the Used Web Dynpro Component field, click Browse and select IObjectValidator .
Click Finish .
In the IWizard window's Properties view, add the IObjectValidator component interface controller as a required controller.
The component usage is already added.
Add the following code to the IWizard window's wdDoInit() method:
wdThis.wdGetIObjectValidatorComponentUsage().createComponent( WizardFWAPIInfo.OBJECT_VALIDATOR_NAME, WizardFWAPIInfo.OBJECT_VALIDATOR_NAMESPACE);
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:
public booleandoBeforeNext( ) { //@@begin doBeforeNext() if (wdContext.currentContextElement().getPaneNumber()==1) { IWDComponentUsage usage = wdContext .currentWizardFWNodeElement().getParamsHolderComponentUsage(); return wdThis.wdGetIObjectValidatorInterface().isValid(usage); } return true; //@@end }
If invalid data is entered, an error message is displayed and the wizard does not navigate to the next pane.