SaaS CMS has officially launched! Learn more now.

Is it possible to pre-populate the dropdown list in the XForm?



I am wondering is it possible to pre-populate some dynamic data to the xform dropdown list box? The scenario is I have a xform that contains a dropdown list box, and I would like to load some page names into it



Apr 29, 2013 17:24

Short answer: There's not an easy way.

What is the end goal of the dropdown? Are you saving it in a database? Emailing? If you want to do this from the .NET code, you'll have to dynamically modify the form definition, then tap into the XForm events to handle the data, which is both a huge headache. I imagine you could also probably do something with JavaScript to fill the dropdown, then override the standard XForm event methods and just make your own methods to handle the data.

Apr 30, 2013 4:46

Hi Chris

My current project needs to have a subscription block section on the sidebar, it needs to have a dropdown listbox that list all pages from certain page type and email textfield, so user could register their interest page. we then can export this data and manually import into campaign monitor to send a campaign. 


The reason I choose xform is the built-in export functionality, so I don't need to create a custom plug-in to extract the data in csv format. Previously for such requirement, I always save the data into the dynamic store and create a custom plug-in to provide the extract functionality.



Apr 30, 2013 17:01

Is this an EPiServer 7 MVC site?

Just an idea, but what I'm thinking you could do is to make the XForm in the system as normal, then in the block view, manually create a form (not using the RenderXForm helper), and pass the XForm ID along with the form. Then when it's submitted, take the values from the form and inject it into the XForm using that ID, and have the XForm submit has normal.

If you're using MVC, check out this post to see how  I made XForms work in a block: This could probably be a good base you could start with.

Apr 30, 2013 17:19
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.