Try our conversational search powered by Generative AI!

Get Xform poll from another page


We've got sort of a "Quiestion of the week" function on our page that I'd like to perfect. As it is today the question shows up followed by a link to the Xform page that contains the question and you can answer it there. I'd like to display the alternatives at the same place as the question is and also have the results of the poll to show up there. How do I do this? They way it is done today is that the question is fetched via LINQ but I don't think that's an alternative for getting the whole questionnaire.

Jan 05, 2011 8:57

Ok, some progress made. I copied the code from the xform page in the public demo pages and in the Form function I changed the code string formGuid = CurrentPage[XFormProperty] as string; to instead use a reference of the page where my questionnaire is posted. This works fine! The votes are all registered.

The problem now is when I want to see the statistics. I get the error message "ExternalId may not be an empty guid". I assume this has to do with the statistics not being referenced to the same page the form itself is, right? Any ideas of how to fix this?

Jan 05, 2011 10:26



Are you using the XFormStatistics web control to show the statistics (as the example user control does). If so, have you tried setting the AllPages property to true?

Linus Ekström

Jan 05, 2011 10:35

That was just the problem I was dealing with at the moment. Couldn't understand why the statistics were so strange. Thanks a million!!

Jan 05, 2011 10:51

There's only one thing messing with me now and I can't see why it does what it does. Or should I perhaps say does what it doesn't.

I press the button to show statistics and the statistics show correctly. Then when I press the button to return to the form the statistics still show. The function for switching (SwitchView) still acts like the statistics aren't visible. I can't get it to switch back and even though I clearly see the statistics are showing the if-statement in the SwitchView function chooses to see it as not visible.

Jan 05, 2011 11:25

Hard to say what it is without having your code. Since the switching logic lies in the templates you should be able to debug this to find the problem.

Jan 05, 2011 13:14

I ended up removing the switch button. It wasn't really needed anyways.

Jan 05, 2011 13:16

Try enable viewstate. There is a check for a panel if it's visible or not that will always be false otherwise.

Also add a line of code
 Statistics.PropertyName = XFormProperty;
Otherwise the property name is hardcoded to be xforms.

Nov 22, 2011 16:21

Hi All,


I included the questionaire like three questions with two radion buttons each.When i click on submit the statistics are displayig but the issue is  for first question two statistics results are showing[fine bcoz my first question contains only two options] but for second and third questions three statistic results are displaying even thouh my 2,3 questions contains only two options.

Can anyone pls suggest me the way to come out?

Thanks in advance


Feb 28, 2012 7:06
* 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.