formio / formio.js

JavaScript powered Forms with JSON Form Builder

Home Page:https://formio.github.io/formio.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Multiple get api calls to fetch data

hm-chirag opened this issue · comments

The form contains 5 select box component whose values will be fetched via api but I want to avoid making 5 api calls, is there a way to make 1 api call for the form and fetch value from the response of that?

Yes, you can do this with the Data Source component, and then use that along with the Logic system of the Select dropdown to modify their data.values property with the results of that Data Source. If you are using our OSS builder, you can achieve the same thing by having a Hidden field on the form, and then in a Form Controller make the single API call and set the value of that Hidden component. Then the Select fields will "Redraw On" that hidden field and use Logic to modify their data.values array.