Skip to content

Commit

Permalink
Fix #827: o:validateBean showMessageFor="@Violating" didn't work when
Browse files Browse the repository at this point in the history
bean is directly referenced in input component (with converter)
  • Loading branch information
BalusC committed Jul 28, 2024
1 parent 01fbec6 commit 5d7816d
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/main/java/org/omnifaces/taghandler/ValidateBean.java
Original file line number Diff line number Diff line change
Expand Up @@ -549,10 +549,19 @@ private static void forEachInputWithMatchingBase(FacesContext context, UICompone

if (valueExpression != null) {
ValueReference valueReference = getValueReference(context.getELContext(), valueExpression);
Object referencedBase = valueReference.getBase();
Object referencedProperty = valueReference.getProperty();

if (bases.contains(valueReference.getBase()) && (property == null || property.equals(valueReference.getProperty()))) {
if (bases.contains(referencedBase) && (property == null || property.equals(referencedProperty))) {
callback.invoke(input);
}
else if (property == null && referencedBase instanceof List && referencedProperty instanceof Integer) {
Object referencedItem = ((List<?>) referencedBase).get((Integer) referencedProperty);

if (bases.contains(referencedItem)) {
callback.invoke(input);
}
}
}
});
}
Expand Down

0 comments on commit 5d7816d

Please sign in to comment.