Skip to content

Commit

Permalink
fix(validate): do not validate hidden fields (#2149)
Browse files Browse the repository at this point in the history
* fix(validate): do not validate hidden fields

* fix(program-rule-variable): default to valueType text
  • Loading branch information
Birkbjo authored Mar 9, 2022
1 parent 93e97bc commit 308258f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/EditModel/form-helpers/validateFields.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const isRequiredField = field => get('isRequired', field.fieldOptions) === true;

const isDirtyField = field => field.value;

const isRequiredOrDirtyField = field => isRequiredField(field) || isDirtyField(field);
const isRequiredOrDirtyField = field => !field.hiddenComponent && (isRequiredField(field) || isDirtyField(field));

const validateField = (field, formRef, formRefStateClone) => {
const validateResult = formRef.validateField(formRefStateClone, field.name, field.value);
Expand Down
1 change: 1 addition & 0 deletions src/config/field-rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,7 @@ export default new Map([
type: 'HIDE_FIELD',
}],
},
createDefaultRuleForField('valueType', 'TEXT')
]],
['programStage', [
{
Expand Down

0 comments on commit 308258f

Please sign in to comment.