13

I have the requirement to create two lists: the second one being dynamically populated with Sitecore data after the user selects a value from the first one. I tried using some Rules for WFFM but can't seem to match any with what I want to have as results.

I would like to have something like countries in the first list. After selecting a value, the second list will dynamically populate the regions depending on the country selected - if the country has regions, else a N/A single element will be added.

What is the best way and approach for doing this dependent drop lists functionality for a WFFM form (Sitecore 8.1 - webforms)?

3
  • 3
    I suspect you're going to need some custom field types to achieve this. Bolt in some JS that calls a back-end REST service to populate the drop-downs, or if there are only a small number of permutations, send all the data in a JSON block to the glass and let JS do the work of re-populating the drop-downs. A couple of decent blogs on the topic include Creating a custom field type in wffm for sitecore and WFFM Session Aware Single-Line Text Field Commented Sep 16, 2016 at 1:34
  • Yes totally agree with Richard Hauer, I also had the same requirement to populate states according to country selection in WFFM, what I did is I have created 2 Dropdown fields in WFFM and hide states DD. And with the help of javascript I have populated country list in DD, and on the selection of country, I used JSON to show appropriate state DD. Commented Sep 19, 2016 at 16:51
  • @GauravAgarwal how did you passed the invalid state error on submit? I also did the implementation of WFFM dependent droplist by using js but now I get a invalid state error on postback of the form since the droplists are populated via js and not in code. Is there a way you managed to bypass that error?
    – Adrian C.
    Commented Sep 20, 2016 at 7:08

1 Answer 1

3

I'm sure I came across an example of linked drop downs in WFFM in the past but can't find find it now. This might be a good basis to start from: http://sitecoreguild.blogspot.co.uk/2013/06/sitecore-country-and-region-dropdowns.html

However you will obviously need to inherit from the right classes for your dropdowns to work, there is a good example here: https://divamatrix.wordpress.com/2011/12/20/wffm-custom-field-type-made-easy/

1
  • 2
    There isn't any substance to this answer, merely external links. I don't believe this meets the guidelines for a good answer.
    – jrap
    Commented Jul 21, 2017 at 1:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.