InseeFr / Lunatic

Library of questionnaire components
https://inseefr.github.io/Lunatic/
MIT License
20 stars 21 forks source link

Add arbitrary option for checkboxOne #1012

Closed Grafikart closed 1 month ago

Grafikart commented 1 month ago

Issue

On some form we want to add an option to allow an additional answer for specific field

Solution

There is not lunatic modelisation for this feature so this PR is a proof of concept and spec. The field is triggered adding extra properties on the "options" field :

{
    "id": "kmort6x9-QOP-kmorue9d",
    "label": {
        "value": "\"Autre\"",
        "type": "VTL"
    },
    "response": { "name": "NATIO1N5" },
+   "detail": {
+       "label": {
+           "value": "\"Préciser : \"",
+           "type": "VTL"
+       },
+       "response": {
+           "name": "NATIO1N5DETAIL"
+       }
+   }
}

Render

image

Limitation

Since it's a POC it's only applied on CheckboxOne to see if the modelisation fit the need.

Fix #204 Fix #951

sonarcloud[bot] commented 1 month ago

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarCloud