Skip to content

Commit

Permalink
fix(categoryCombo): make categories required
Browse files Browse the repository at this point in the history
  • Loading branch information
Birkbjo committed Sep 9, 2024
1 parent 1b70c09 commit 71d82da
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/config/field-overrides/categoryCombo.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ import MultiSelect from '../../forms/form-fields/multi-select';

export default new Map([
['categories', {
required: true,
validators: [{ // regular isRequired does not check for empty collection or array
validator(value, formState) {
return value && value.size > 0;
},
message: 'categories_cannot_be_empty',
}],
component: (props) => {
let queryFilter;

Expand Down
1 change: 1 addition & 0 deletions src/i18n/i18n_module_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2389,3 +2389,4 @@ org_unit_target=Organisation unit target
ownership=Ownership
validation_result=Validation result
sql=SQL
categories_cannot_be_empty=Categories cannot be empty

0 comments on commit 71d82da

Please sign in to comment.