Validation in wizard

StatusIDPriorityType
Closed38953MajorQuestion
ProfileReply
PatjamesClient

How do you validate visible properties only in a wizardpage on wizard control before user clicks next page

Replies

UserDescriptionPosted On
MariyaVoytovichAgent

Hello!

For validation, you can use the validation rules of DevExpress. See Validation Rules.

Feel free to contact us if you need further assistance or have additional questions.

Regards,
Mariya
On behalf of Xafari Client Services Team

PatjamesClient

We tested validation rules on the wizard.
When the user clicks Next.
The wizard goes to the next page even if there are validation errors on current page.

MariyaVoytovichAgent

You need to subscribe to the CustomNextStep event of the WizardDialogController controller.
For an example, you can look in our FeatureCenter demo example how to sneak up on the CustomNextStep event (see the popupWindowShowAction1_CustomizePopupWindowParams event handler in the FeatureCenter.Module\Wizard\WizardsViewController file).

In the CustomNextStep event handler, you need to check the object using the RuleSet.ValidateTarget (IObjectSpace, Object, ContextIdentifiers) method.
For instance:


void controller_CustomNextStep(object sender, CustomNextStepEventArgs e)
{
var controller = (WizardDialogController)sender;

RuleSetValidationResult result = Validator.RuleSet.ValidateTarget(this.Application.CreateObjectSpace(), controller.Frame.View.CurrentObject, ContextIdentifier.Save);
if (result.ValidationOutcome > ValidationOutcome.Information)
{
e.NextStep = e.CurrentStep;
}
else if (e.CurrentStep.Index == 0)
{
if (!string.IsNullOrEmpty(e.WizardObject().String1) && e.WizardObject().String1.StartsWith("1"))
e.NextStep = e.CurrentStep.Wizard[2];
}
}

× This ticket is closed.

Write US