I'm trying to build a custom field type for umbraco forms which is a cascading dropdowns.
I have one select box which will be populated from nodes in umbraco. Depending on the user choice - it will populate the 2nd select box with the children nodes of the node selected in dropdown 1.
Any ideas on how I can achieve this or even if this is possible??
The first thing that comes to mind is using the Umbraco API and jquery / AJAX - on select of the first select box, you'd pass the selected node ID back to the API and it would return JSON containing the child names / ids. Your jquery could then iterate the JSON and build a list of options for the select list.
Another way would be to output ALL parent / child node data into javascript arrays on page load, and then use jQuery / JavaScript to populate the second select list based on the selection of the first - this saves the round trips to the server, but adds to initial page load.
Yes I think your logic is sound - actually I'm trying to build this as a custom field type in umbraco forms (sorry don't think I made that clear in the original post) - I'm having difficulty wiring up the dropdowns to a controller to populate the select boxes and then also been able to store the selections when the form is submitted..
Good luck with this! As far as I can see, Umbraco Forms is pretty much a black box. You can find minor examples of creating custom field types, but nothing very sophisticated. Try to find out how to create a custom drop down or prevalue datasource... It's near impossible. For a paid product, I'm really disappointed in how poorly supported Forms is.
Cascadding dropdowns custom field type
Hello,
I'm trying to build a custom field type for umbraco forms which is a cascading dropdowns. I have one select box which will be populated from nodes in umbraco. Depending on the user choice - it will populate the 2nd select box with the children nodes of the node selected in dropdown 1.
Any ideas on how I can achieve this or even if this is possible??
Thanks for your help
Hi James
The first thing that comes to mind is using the Umbraco API and jquery / AJAX - on select of the first select box, you'd pass the selected node ID back to the API and it would return JSON containing the child names / ids. Your jquery could then iterate the JSON and build a list of options for the select list.
Another way would be to output ALL parent / child node data into javascript arrays on page load, and then use jQuery / JavaScript to populate the second select list based on the selection of the first - this saves the round trips to the server, but adds to initial page load.
Just some ideas.
Cheers, Nigel
Yes I think your logic is sound - actually I'm trying to build this as a custom field type in umbraco forms (sorry don't think I made that clear in the original post) - I'm having difficulty wiring up the dropdowns to a controller to populate the select boxes and then also been able to store the selections when the form is submitted..
Hi John,
Were you able to build these custom field type/s?
Thanks, Kunal
Hi John,
We are also looking for a solution to create cascading dropdown list using Umbraco forms. Did you achieve it ? Thanks for your help. Etienne
Good luck with this! As far as I can see, Umbraco Forms is pretty much a black box. You can find minor examples of creating custom field types, but nothing very sophisticated. Try to find out how to create a custom drop down or prevalue datasource... It's near impossible. For a paid product, I'm really disappointed in how poorly supported Forms is.
is working on a reply...