Skip to content

Commit b1cf727

Browse files
committed
Bugfix: mandatory field validation
1 parent 3f9d526 commit b1cf727

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ export default function DynamicForm({ formTemplate, onSubmit }) {
1313
const mandatoryFields = formTemplate.data.filter(data => data.is_mandatory);
1414

1515
useEffect(() => {
16+
formTemplate.data.sort((a, b) => a.index - b.index);
1617
setFormFields({
1718
...formFields,
1819
...setDefaultForFields()
1920
});
2021
}, []);
2122

2223
useEffect(() => {
23-
formTemplate.data.sort((a, b) => a.index - b.index);
2424
const isValid = checkAllMandatoryFields();
2525
setValid(isValid);
2626
}, [JSON.stringify(formFields)]);

0 commit comments

Comments
 (0)