1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-19 02:22:05 +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,7 +59,13 @@ public class FillableForm extends FilledForm {
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);