I am looking to create a form using Formulate and there are fields on this form that need values from a data source by getting them via an API, for example drop list values. I see there is a "Data Sources" option available and that it hasn't been implemented yet.
Are there any plans to implement this soon? If not, is there a way I can achieve pulling field data from an API without using this feature? A lot of the forms we want to make using Formulate will need custom field data, so a solution to this problem would be great.
The "Data Sources" feature isn't what you are looking for. The idea behind "Data Sources" would be for things like storing a connection string if you want to submit a form to a different database, or storing SMTP credentials in case you don't want to use the defaults in the web.config. However, like you've noticed, that hasn't bee implemented yet.
Instead, what you want are "Data Values". Probably the easiest way to achieve what you are looking for would be to create a data value and select the type of "List Function":
Once you've created your class, you can then select it from your list function data value.
You can also create a fully custom data value, but that's probably more advanced than you need. You might want to do that, for example, if you need to provide an interface to specify parameters to be passed to your function that gathers values.
Just another quick one, I've been trying to render my form using the way suggest on this link, but formulate.api.Rendering doesn't seem to exist anymore from looking at the source? So I've just been doing it this way for now, is this the correct way?
You'd want formulate.api.Rendering with Umbraco 7 (Formulate 2.x), which is not necessary with Umbraco 8 (Formulate 3.x).
Using custom data sources for fields
Hi,
I am looking to create a form using Formulate and there are fields on this form that need values from a data source by getting them via an API, for example drop list values. I see there is a "Data Sources" option available and that it hasn't been implemented yet.
Are there any plans to implement this soon? If not, is there a way I can achieve pulling field data from an API without using this feature? A lot of the forms we want to make using Formulate will need custom field data, so a solution to this problem would be great.
Thanks!
The "Data Sources" feature isn't what you are looking for. The idea behind "Data Sources" would be for things like storing a connection string if you want to submit a form to a different database, or storing SMTP credentials in case you don't want to use the defaults in the web.config. However, like you've noticed, that hasn't bee implemented yet.
Instead, what you want are "Data Values". Probably the easiest way to achieve what you are looking for would be to create a data value and select the type of "List Function":
You would also have to create a class that implements the ISupplyValueAndLabelCollection interface. You can read more about that here: https://our.umbraco.com/packages/backoffice-extensions/formulate/formulate-questions/79633-formulate-036-just-released-data-value-list-functions
Once you've created your class, you can then select it from your list function data value.
You can also create a fully custom data value, but that's probably more advanced than you need. You might want to do that, for example, if you need to provide an interface to specify parameters to be passed to your function that gathers values.
You'd want
formulate.api.Rendering
with Umbraco 7 (Formulate 2.x), which is not necessary with Umbraco 8 (Formulate 3.x).is working on a reply...