November Happy Hour will be moved to Thursday December 5th.

Loading data in to an XForm

Vote:
 

Hi

I am very new to EPiServer development, so this may be a rookie question, but here goes!

In EPiServer 7.5 I have a block containing an XFrom for setting user preferences. The form consists of 1 textbox (email address) and 4 checkboxes for mailing preferences. When the form is created the controller reads the current preference settings from the database, using an ID paramater passed in the URL, and I then want to pre-populate the form with these details. 

I can get the email address textbox populated using the following code:

viewModel.Form.SetInstanceData("email", email);

However, I can't seem to use this for setting the checked value of a checkbox. Has anyone had any experiance in this kind of thing who could point me in the right direction?

Cheers, Chris.

#131360
Jul 22, 2015 10:10
Vote:
 

Hi,

What you could do I think have your own render template of xform. By doing this, you could read from setting and decided what to render. You could refer to following blog http://www.eyecatch.no/blog/2013/09/full-customization-of-xforms-with-episerver-7-and-mvc/.

I think that easy way to go.

#131361
Jul 22, 2015 10:57
* 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.