Open Mottie opened 4 years ago
For the example on this page: https://department-of-veterans-affairs.github.io/veteran-facing-services-tools/forms/available-features-and-usage-guidelines#checkbox-group
We got it working using the following code:
but a showFieldLabel is needed to get the validation to show up
Lastly, adding that showFieldLabel option makes it include a second nested <fieldset> (without a legend) inside the outer one...
showFieldLabel
<fieldset>
Work for ticket https://app.zenhub.com/workspaces/forms-library---platform-spike-team-61b0ae1f2cd3c30014e8a5b0/issues/department-of-veterans-affairs/formulate/127 will update check box documentation.
What is your documentation request, question, comment, or issue?
For the example on this page: https://department-of-veterans-affairs.github.io/veteran-facing-services-tools/forms/available-features-and-usage-guidelines#checkbox-group
We got it working using the following code:
Click to expand
``` race: { 'ui:field': RaceEthnicityReviewField, 'ui:title': 'Which categories best describe you?', 'ui:description': 'You may check more than one.', isSpanishHispanicLatino: { 'ui:title': 'Spanish, Hispanic, or Latino', }, isAmericanIndianOrAlaskanNative: { 'ui:title': 'American Indian or Alaskan Native', }, isBlackOrAfricanAmerican: { 'ui:title': 'Black or African American', }, isNativeHawaiianOrOtherPacificIslander: { 'ui:title': 'Native Hawaiian or Other Pacific Islander', }, isAsian: { 'ui:title': 'Asian', }, isWhite: { 'ui:title': 'White', }, 'ui:required': () => true, 'ui:validations': [ (errors, fields) => { if ( !( fields.isSpanishHispanicLatino || fields.isAmericanIndianOrAlaskanNative || fields.isBlackOrAfricanAmerican || fields.isNativeHawaiianOrOtherPacificIslander || fields.isAsian || fields.isWhite ) ) { errors.addError('Choose at least one category'); } }, ], 'ui:options': { showFieldLabel: true, }, }, ```but a showFieldLabel is needed to get the validation to show up
Lastly, adding that
showFieldLabel
option makes it include a second nested<fieldset>
(without a legend) inside the outer one...Screenshot
![](https://user-images.githubusercontent.com/136959/90271037-ceea4200-de20-11ea-8f33-a1b6c44511e0.png)