Umbraco Forms Datasource Webservice

673 views Asked by At

I'm using Umbraco Forms in a new websites. This website has Merchello enabled, so I got products in there too. I want to create an enquiry/request form and collect the country of requester (so I shall show a full list of countries), and enable requester to select products they are interested in too.

Thus, the form will have fields like Countries drop down list as well as products to choose from. For countries I have got them all listed in a config file, and created a web api that inherits from UmbracoApiController - when creating the form in the back office I get the method invoked successfully but receive an error when returning the list. Whereas to access products list I shall inherit from MerchelloApiController, which when I do I could never invoke the api controller.

Two questions: 1. How could I show the list of countries (reading from file or service)? 2. How could I access Merchello products list to populate Products' drop down list on Umbraco forms?

1

There are 1 answers

0
Mario Lopez On

Yo should use Prevalue Sources instead a Webservice Datasource. Datasources are to map Umbraco Form fields to external services.

With Prevalue Sources you can get data to populate your dropdowns. You say you have your countries in a fie already so you could use the 'Get values from textfile' type.

To get your Merchello products you could probably use NuPickers. You could create a data type of DotNet type and select your source class that will return a list of your products. Then create a Prevalues source of type 'Umbraco datatype prevalues' that uses this datatype to get the data to populate your dropdown.

I hope all this info will put you in the right track.