Skip to content

Commit

Permalink
Merge pull request #467 from Flowdalic/4.4-data-forms
Browse files Browse the repository at this point in the history
Proposed data form updates for 4.4
  • Loading branch information
Flowdalic authored Jun 4, 2021
2 parents 26e6efa + 090858f commit 899813a
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,13 @@ public FillableForm(DataForm dataForm) {
if (formField.isRequired()) {
String fieldName = formField.getFieldName();
requiredFields.add(fieldName);
missingRequiredFields.add(fieldName);

if (formField.hasValueSet()) {
// This is a form field with a default value.
write(formField);
} else {
missingRequiredFields.add(fieldName);
}
}
}
this.requiredFields = Collections.unmodifiableSet(requiredFields);
Expand Down Expand Up @@ -224,9 +230,6 @@ public final void write(FormField filledFormField) {
if (!getDataForm().hasField(fieldName)) {
throw new IllegalArgumentException();
}
if (filledFields.containsKey(fieldName)) {
throw new IllegalArgumentException();
}

// Perform validation, e.g. using XEP-0122.
// TODO: We could also perform list-* option validation, but this has to take xep122's <open/> into account.
Expand Down

0 comments on commit 899813a

Please sign in to comment.