Skip to content

Commit

Permalink
FIO-8719 fixed validation for Data Grid component inside nested wizard
Browse files Browse the repository at this point in the history
  • Loading branch information
HannaKurban authored and lane-formio committed Aug 13, 2024
1 parent 32030da commit d895e54
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/Wizard.unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -421,8 +421,10 @@ describe('Wizard tests', () => {
setTimeout(() => {
checkPage(2);
const errors = wizard.errors;
assert.equal(errors.length, 1, 'Must err before next page');
assert.equal(errors[0].message, 'Text Field is required');
assert.equal(errors.length, 2, 'Must err before next page');
errors.forEach((error) => {
assert.equal(error.ruleName, 'required');
});
done();
}, 300)
}, 300)
Expand Down
2 changes: 1 addition & 1 deletion src/components/_classes/nested/NestedComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,7 @@ export default class NestedComponent extends Field {
validationProcessor({ scope, data, row, instance, component }, flags) {
const { dirty } = flags;
if (this.root.hasExtraPages && this.page !== this.root.page) {
instance = this.getComponentById(component.id);
instance = this.getComponent(component.path);
}
if (!instance) {
return;
Expand Down
27 changes: 27 additions & 0 deletions test/forms/wizardWithRequiredFields.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,33 @@ export default {
'key': 'textField',
'type': 'textfield',
'input': true
},
{
'label': 'Data Grid',
'reorder': false,
'addAnotherPosition': 'bottom',
'layoutFixed': false,
'enableRowGroups': false,
'initEmpty': false,
'tableView': false,
'validateWhenHidden': false,
'key': 'dataGrid',
'type': 'datagrid',
'input': true,
'components': [
{
'label': 'Text Field',
'applyMaskOn': 'change',
'tableView': true,
'validate': {
'required': true
},
'validateWhenHidden': false,
'key': 'textField',
'type': 'textfield',
'input': true
}
]
}
],
'input': false,
Expand Down

0 comments on commit d895e54

Please sign in to comment.