You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm not sure this qualifies as a bug exactly, but it seemed fitting enough. It seems like a bug that I can accidentally hide the validation messages.
Describe the bug
The field label is required to show validation messages, which means we have to employ some odd workarounds at times. For example, let's say we want to make the following:
We could do something like:
uiSchema:
'view:uploadPrivateRecords': {'ui:title':
'Do you want to upload your private medical records?','ui:widget': 'radio','ui:options': {labels: {yes: 'Yes',no: 'No, please get them from my doctor',},},},'view:patientAcknowledgement': {'ui:options': {expandUnder: 'view:uploadPrivateRecords',expandUnderCondition: 'no',},},'view:patientAcknowledgementDescription': {'ui:description': patientAcknowledgmentText},},schema: {type: 'object',required: ['view:uploadPrivateRecords'],properties: {'view:uploadPrivateRecords': {type: 'string',enum: ['yes','no'],},'view:patientAcknowledgement': {type: 'object',required: ['view:acknowledgement'],properties: {'view:acknowledgement': {type: 'boolean',default: true,},},},'view:patientAcknowledgementDescription': {type: 'object',properties: {},},}
But when the check box isn't checked and the validation is triggered, the validation message doesn't appear on the screen. This is because the check box--the field that triggered the validation--doesn't have a title for the message to "hook" onto. We then have to change it up and add an "empty" title, which creates the awkward space between the radio button and check box in the screenshot above.
uiSchema:
'view:uploadPrivateRecords': {'ui:title':
'Do you want to upload your private medical records?','ui:widget': 'radio','ui:options': {labels: {yes: 'Yes',no: 'No, please get them from my doctor',},},},'view:patientAcknowledgement': {'ui:title': ' ','ui:help': patientAcknowledgmentText,'ui:options': {expandUnder: 'view:uploadPrivateRecords',expandUnderCondition: 'no',showFieldLabel: true,},}},
schema: {type: 'object',required: ['view:uploadPrivateRecords'],properties: {'view:patientAcknowledgement': {type: 'object',required: ['view:acknowledgement'],properties: {'view:acknowledgement': {type: 'boolean',default: true,},},},'view:privateRecordsChoiceHelp': {type: 'object',properties: {},},},}
I think we can generalize the issue and say that the developer shouldn't be able to pass any combination of options to the field that will hide validation messages. Allowing that makes it confusing when we accidentally pass a bad configuration and can't figure out why the validation message isn't showing up. Those are the kinds of things, I think, that make developers shy away from certain libraries.
To Reproduce
🤔 I guess try the above?
Create a boolean field
Don't give it a ui:option of showFieldLabel: true
Give it a custom validation
Go through the form and trigger the validation
Expected behavior
As a developer, I should be able to pass any valid configuration to any field and still expect validation messages to show up when appropriate.
The text was updated successfully, but these errors were encountered:
jcmeloni-usds
changed the title
Field label required for validation message to be displayed
BUG? Field label required for validation message to be displayed
Oct 23, 2018
I'm not sure this qualifies as a bug exactly, but it seemed fitting enough. It seems like a bug that I can accidentally hide the validation messages.
Describe the bug
The field label is required to show validation messages, which means we have to employ some odd workarounds at times. For example, let's say we want to make the following:
We could do something like:
But when the check box isn't checked and the validation is triggered, the validation message doesn't appear on the screen. This is because the check box--the field that triggered the validation--doesn't have a title for the message to "hook" onto. We then have to change it up and add an "empty" title, which creates the awkward space between the radio button and check box in the screenshot above.
I think we can generalize the issue and say that the developer shouldn't be able to pass any combination of options to the field that will hide validation messages. Allowing that makes it confusing when we accidentally pass a bad configuration and can't figure out why the validation message isn't showing up. Those are the kinds of things, I think, that make developers shy away from certain libraries.
To Reproduce
🤔 I guess try the above?
ui:option
ofshowFieldLabel: true
Expected behavior
As a developer, I should be able to pass any valid configuration to any field and still expect validation messages to show up when appropriate.
The text was updated successfully, but these errors were encountered: