Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conditional color formatting #86

Open
annabel-uzl opened this issue Jun 13, 2024 · 4 comments
Open

Conditional color formatting #86

annabel-uzl opened this issue Jun 13, 2024 · 4 comments

Comments

@annabel-uzl
Copy link

Is it possible to create a form with conditional formatting using the formbuilder? For example: an answer field becomes e.g. RED if a value is bigger than 100 and green otherwise.
If so, how?

@plynchnlm
Copy link
Member

A currently supported mechanism would be to have two questions with different styles, and you use enableWhen to pick which one to show.

An approach in FHIR one could use (but which I suspect is not supported anywhere), would be use the cqf-expression extension to set the value of the rendering-style extension. The current FHIR Structured Data Capture IG indicates that cqf-expression is recommended for support on the elements minOccurs, maxOccurs, required, repeats, readOnly , answerValueSet, text. If you think it is worth adding rendering-style to that list, please make the case for it on the questionnaire stream at chat.fhir.org. The formbuilder does not yet have support for cqf-expression, nor does LHC-Forms, but it is on our list.

@annabel-uzl
Copy link
Author

Yes good idea! The cqf-expression I'll keep in mind. Thanks!

@annabel-uzl
Copy link
Author

About the colors:
I notice the color of the question changing while I actually want to change the color of the answer depending on the answer. Is that a possibility?
image

@plynchnlm
Copy link
Member

Oh, I misunderstood. I don't think that is possible. There are minValue and maxValue extensions you can use to prevent the user from entering values outside of a range. Do you want the user to be able to enter the value outside of a range, and get a warning? (I don't think a color change is sufficient in that case.) If so, I don't think there is a way to indicate that in FHIR, but there probably should be. If that is something you want, could you post a question on the "questionnaire" stream at chat.fhir.org? There might be some way to do that I am not aware of. (There isn't a way to do it in LForms, but once there is agreement on how that might work in FHIR Questionnaire, we can add support.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants