Skip to content

Commit

Permalink
Merge pull request #236 from vanduynslagerp/param-required-validation
Browse files Browse the repository at this point in the history
Fail validation if @param required attribute is not satisfied
  • Loading branch information
BalusC committed Apr 11, 2016
2 parents cd97323 + 02b6f36 commit 1b6a22f
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ private Object getConvertedValue(FacesContext context, UIComponent component, St

if (requestParameter.required() && isEmpty(convertedValue)) {
addRequiredMessage(context, component, label, submittedValue, getRequiredMessage(requestParameter));
valid = false;
}

// Validate the converted value
Expand All @@ -132,8 +133,9 @@ private Object getConvertedValue(FacesContext context, UIComponent component, St
if (shouldDoBeanValidation(requestParameter)) {

Set<ConstraintViolation<?>> violations = doBeanValidation(convertedValue, injectionPoint);

valid = violations.isEmpty();
if (!violations.isEmpty()) {
valid = false;
}

for (ConstraintViolation<?> violation : violations) {
context.addMessage(component.getClientId(context), createError(violation.getMessage(), label));
Expand Down

0 comments on commit 1b6a22f

Please sign in to comment.