jsonform / jsonform

Build forms from JSON Schema. Easily template-able. Compatible with Bootstrap 3 out of the box.
https://jsonform.github.io/jsonform/playground/index.html
MIT License
2.72k stars 553 forks source link

titleMap in selectbox array #428

Closed JesperL01 closed 1 year ago

JesperL01 commented 1 year ago

I would like the end-user to be able to input an array of options using selectboxes that each should use the titleMap feature.

I can get it to work with a single selectbox but not when using an array.

Running the code below in playground will immediately show what goes wrong.

Is this a bug or missing feature in jsonform or am i doing it wrong? I am new to jsonform and have also tried to solve this issue using 'oneOf' function without any luck.

Any help or information would be much appreciated.

{ "schema": { "selectboxes": { "type": "array", "items": { "type": "string", "title": "Add items using select", "properties": { "abox": { "title": "Would like a generic array of select boxes", "description": "Where all use the titleMap", "enum": [ "s10", "s12", "s42" ] } } } } }, "form": [ { "key": "selectboxes[].abox", "titleMap": { "s10": "Default", "s12": "Some choice", "s42": "Some other choice" } }, { "type": "array", "items": [ "selectboxes[].abox" ] } ], "value": { "selectboxes": [ "s42", "s12" ] } }

sdetweil commented 1 year ago

there is no current support for an array of select boxes

JesperL01 commented 1 year ago

Thank you for your reply. This helps a lot. As I've gotten "something" to work without using titleMap, I will abandon the idea of array-of-selectboxes and create the same functionality using other components.

sdetweil commented 1 year ago

can we close this?

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.