1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-26 00:02:06 +01:00

[xdata] Automatically fill required fields with a default value

This commit is contained in:
Florian Schmaus 2021-04-01 12:55:28 +02:00
parent 68edc8b9f5
commit 090858f467

View file

@ -59,9 +59,15 @@ public class FillableForm extends FilledForm {
if (formField.isRequired()) { if (formField.isRequired()) {
String fieldName = formField.getFieldName(); String fieldName = formField.getFieldName();
requiredFields.add(fieldName); requiredFields.add(fieldName);
if (formField.hasValueSet()) {
// This is a form field with a default value.
write(formField);
} else {
missingRequiredFields.add(fieldName); missingRequiredFields.add(fieldName);
} }
} }
}
this.requiredFields = Collections.unmodifiableSet(requiredFields); this.requiredFields = Collections.unmodifiableSet(requiredFields);
} }