Skip to content

Commit

Permalink
force required check if the submitted form does not contains the field
Browse files Browse the repository at this point in the history
  • Loading branch information
syjer committed Jun 8, 2019
1 parent 3cc4c83 commit 9fb3103
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/main/java/alfio/util/Validator.java
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,13 @@ public static ValidationResult validateTicketAssignment(UpdateTicketOwnerForm fo
boolean isField = form.getAdditional() !=null && form.getAdditional().containsKey(fieldConf.getName());

if(!isField) {
if (fieldConf.isRequired()) { // sometimes the field is not propagated, so, if it's required, we need to do some additional work
if (form.getAdditional() == null) {
form.setAdditional(new HashMap<>());
}
form.getAdditional().put(fieldConf.getName(), Collections.singletonList(""));
errors.rejectValue(prefixForLambda + "additional["+fieldConf.getName()+"][0]", "error."+fieldConf.getName());
}
continue;
}

Expand Down

0 comments on commit 9fb3103

Please sign in to comment.