Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

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

Vote:
 

Hi 

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

Thanks,

V

#70763
Apr 29, 2013 17:24
Vote:
 

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.

#70777
Apr 30, 2013 4:46
Vote:
 

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.

Cheers,

V

#70807
Apr 30, 2013 17:01
Vote:
 

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: http://cjsharp.com/blog/2013/04/11/creating-a-xform-block-in-episerver-7-mvc-with-working-validation-updated/. This could probably be a good base you could start with.

#70809
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.