Skip to content

Commit

Permalink
fix(core/forms): add label instead of value for field with choices in…
Browse files Browse the repository at this point in the history
…to form string identifier
  • Loading branch information
sara-gnucoop authored and trik committed Jan 26, 2021
1 parent 208a32a commit da1711f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core/forms/utils/forms/build-form-string-identifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,15 @@ export const buildFormStringIdentifier =
if (choice == null) {
return;
}
context[field.name] = choice.value;
context[field.name] = choice.label;
} else if (
field.fieldType === AjfFieldType.MultipleChoice && Array.isArray(value) &&
value.length > 0) {
const strings = buildStringIdentifierOpts(opts);
const multipleChoiceField = field as AjfMultipleChoiceField<unknown>;
const choices =
multipleChoiceField.choicesOrigin.choices.filter(c => value.indexOf(c.value) > -1);
context[field.name] = choices.join(strings.valuesDivider);
context[field.name] = choices.map(c => c.label).join(strings.valuesDivider);
}
});
}
Expand Down

0 comments on commit da1711f

Please sign in to comment.