formio / angular

JSON powered forms for Angular
https://formio.github.io/angular-demo
MIT License
646 stars 472 forks source link

How to make two select component dependent using Data Source - Raw JSON #824

Closed abhinit217 closed 9 months ago

abhinit217 commented 3 years ago

I am trying to design country and state dependent dropdown using select component Data Source - Raw JSON.

My form json is something like this

{ "components": [ { "label": "Country", "widget": "choicesjs", "placeholder": "Select country", "tableView": true, "dataSrc": "json", "data": { "values": [ { "label": "", "value": "" } ], "json": [ { "country_id": "1", "name": "India" }, { "country_id": "2", "name": "USA" } ] }, "template": "{{ item.name }}", "selectThreshold": 0.3, "validate": { "required": true }, "key": "country", "type": "select", "indexeddb": { "filter": {} }, "input": true }, { "label": "State", "widget": "choicesjs", "placeholder": "Select state", "tableView": true, "dataSrc": "json", "data": { "values": [ { "label": "", "value": "" } ], "json": [ { "state_id": "1", "country_id": "1", "name": "India State1" }, { "state_id": "2", "country_id": "1", "name": "India State2" }, { "state_id": "3", "country_id": "2", "name": "USA State1" }, { "state_id": "4", "country_id": "2", "name": "USA State2" } ] }, "template": "{{ item.name }}", "selectThreshold": 0.3, "validate": { "required": true }, "key": "state", "type": "select", "indexeddb": { "filter": {} }, "input": true }, { "type": "button", "label": "Submit", "key": "submit", "disableOnInvalid": true, "input": true, "tableView": false } ] }

Now the question is i am not able to filter India state or USA state in state select component according to country select.

Please advice how to make it workable using Raw JSON. I am able to do it using Data Source - URL but i can't make api call in offline mode(without internet) so trying to do same work using Raw JSON.

lane-formio commented 9 months ago

We're currently addressing a backlog of GitHub issues, and as part of this effort, some inactive issues may be marked as closed. This isn't a dismissal, but a step toward more efficient tracking.

If you feel the issue is still relevant, please re-open and we'll ensure it gets the attention it deserves. Your understanding is appreciated as we work to enhance our open-source responsiveness.