-
Notifications
You must be signed in to change notification settings - Fork 31
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
Store the display value of a selected codelist entry in the datamodel #1104
Comments
One solution might be to have something like {
"type": "RadioButtons",
"dataModelBindings":{
"simpleBinding": "normal.store.of.key",
"valueBinding": "additional.store.of.translated.tekst.shown"
}
} |
I agree with @ivarne, but I'll add that it feels a bit redundant to include the word So: {
"type": "RadioButtons",
"dataModelBindings":{
"simpleBinding": "normal.store.of.key",
"label": "additional.store.of.translated.tekst.shown"
}
} It might also be worth noting that this solution is (in a way) already in place in the |
Possibly related, if the use case is to display the label (instead of the value) elsewhere: #1105 This is the same as solution 2. |
Yup, I think we should have both! The expression for looking up the display value of a component would be nice, but at the same time that display value might not be very machine readable. I think part of the point of having this in the data model is that it can be extracted and processed in backend code (or on the receiving end when the form is submitted). One more thing Ronny reminded me about today: This probably requires us to map to more list-like structures in the data model. For a checkbox group, comma-separated option values might work, but option labels are far more likely to contain commas (as they are meant to be human readable). Making this work smoothly might require us to know more about the data model and store the display values properly (see #990). |
Solution 2 is kind of possible now since #1341 . You can now get the formatted value of any component including the label of a selected code list using the new {
"textResourceBindings": {
"title": ["concat", ["text", "selectedColor"], ": ", ["displayValue", "radio-button-component"]]
}
} Which would result in something like
|
Putting this on blocked as I might have discovered a bug in the PATCH while working on this. If you add an subtract a value in a list, and this ends up in the PATCH request we end up with this payload: As you can see, value 4 was first deleted, but then we try to insert a value in the same position. We end up with this response from backend: |
Description
Codelists are connected to checkboxes, radiobuttons and dropdowns and consist of a key/value pair. Today only the key is persisted when these fields are connected to the data model.There are however several cases where you would like to store the actual text displayed to the user as well in order to reference that field later in the form. This can be achieved today by doing an additional lookkup on DataProcessWrite, but this requires C# and extra complexity just for storing an already known value.
Additional Information
This should not be solved using a | (or other symbol) and store both values in the same field as this only pushes complexity further down the processing chain.
Blocked by: #1175
Possible solutions:
Tasks
No response
Acceptance Criterias
The text was updated successfully, but these errors were encountered: