diff --git a/src/eq_schema/builders/routing2/newRoutingDestination/index.js b/src/eq_schema/builders/routing2/newRoutingDestination/index.js index 32332af5..6a949767 100644 --- a/src/eq_schema/builders/routing2/newRoutingDestination/index.js +++ b/src/eq_schema/builders/routing2/newRoutingDestination/index.js @@ -27,12 +27,16 @@ const getOptionValues = (optionIds, questionnaire) => { const optionResults = optionIds.map((id) => { const option = find(options, { id }); - const updatedLabel = option.label + const optionContent = option.value + ? option.value.trim() + : option.label.trim(); + + const updatedContent = optionContent .replace(/'/g, `\u2019`) .replace(/'/g, `\u2019`) .replace(/‘/g, `\u2019`); - return updatedLabel.trim(); + return updatedContent.trim(); }); if (optionResults === undefined || optionResults.length < 0) { diff --git a/src/eq_schema/schema/Answer/index.js b/src/eq_schema/schema/Answer/index.js index e6560dc1..66fcf606 100644 --- a/src/eq_schema/schema/Answer/index.js +++ b/src/eq_schema/schema/Answer/index.js @@ -248,13 +248,14 @@ class Answer { } static buildOption( - { label, description, additionalAnswer, qCode: q_code }, + { label, description, additionalAnswer, qCode: q_code, value }, { properties, type }, ctx ) { + const optionValue = value ? value : label; const option = { label: buildContents(label, ctx, true), - value: buildContents(label, ctx, true), + value: buildContents(optionValue, ctx, true), }; if (q_code) { @@ -279,6 +280,7 @@ class Answer { } } } + return option; } }