Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Warren 5 posts 95 karma points
    Mar 10, 2020 @ 12:44
    Warren
    0

    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!

  • Nicholas Westby 2054 posts 7103 karma points c-trib
    Mar 10, 2020 @ 18:29
    Nicholas Westby
    1

    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":

    The Create Data Value Screen in Formulate

    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.

  • Nicholas Westby 2054 posts 7103 karma points c-trib
    Mar 11, 2020 @ 21:08
    Nicholas Westby
    0

    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).

Please Sign in or register to post replies

Write your reply to:

Draft