Skip to content

Commit

Permalink
fix for MID-8886 Validations are triggered incorrectly
Browse files Browse the repository at this point in the history
  • Loading branch information
KaterynaHonchar committed Sep 10, 2023
1 parent 4620d9d commit 1674cf1
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
*/
package com.evolveum.midpoint.gui.impl.prism.panel;

import com.evolveum.midpoint.web.util.ExpressionValidator;

import org.apache.commons.collections4.CollectionUtils;
import org.apache.wicket.Component;
import org.apache.wicket.ajax.AjaxEventBehavior;
Expand All @@ -16,6 +18,7 @@
import org.apache.wicket.feedback.ComponentFeedbackMessageFilter;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.LambdaModel;
import org.apache.wicket.model.PropertyModel;

import com.evolveum.midpoint.gui.api.component.BasePanel;
Expand Down Expand Up @@ -157,6 +160,7 @@ protected void createValuePanel(MidpointForm form) {
panelCtx.setAjaxEventBehavior(createEventBehavior());
panelCtx.setMandatoryHandler(getMandatoryHandler());
panelCtx.setVisibleEnableBehaviour(createVisibleEnableBehavior());
panelCtx.setExpressionValidator(createExpressionValidator());
panelCtx.setFeedback(feedback);

Component component;
Expand All @@ -174,6 +178,18 @@ protected void createValuePanel(MidpointForm form) {
}
}

private ExpressionValidator createExpressionValidator() {
ItemWrapper itemWrapper = getModelObject().getParent();
return new ExpressionValidator(
LambdaModel.of(() -> itemWrapper.getFormComponentValidator()), getPageBase()) {

@Override
protected ObjectType getObjectType() {
return getObject();
}
};
}

protected String getCssClassForValueContainer() {
return "";
}
Expand Down

0 comments on commit 1674cf1

Please sign in to comment.