Has anyone been able to get XForm Statistics - Polls to work in EPiServer 7 using MVC ? If so please can you guide me in the right direction
did you maybe found the solution for this ?
I am trying to do custom rendering in MVC. I can get statistics via GetPostedDataStatistics(....) but I dont know how to get the select options. I can get them if somebody already voted by GetPostedData() for every voted select option but I don't think that this is the way. Should I parse Form.Document xml to get all available options?
I have succeded on this way:
var htmlFragments = form.CreateHtmlFragments();
var choices = new List<PollAnswerViewModel>();
foreach (var item in htmlFragments)
if (item is EPiServer.XForms.Parsing.Select1AsRadiobuttonFragment)
var fragment = item as EPiServer.XForms.Parsing.Select1AsRadiobuttonFragment;
var options = fragment.Options;
foreach (var select in options)
var pollAnswerItem = new PollAnswerViewModel
Answer = @select.Text,
Value = @select.Value
viewModel.PollAnswers = choices;
If somebody maybe has the better way, please say it :)