AI OnAI Off
// (remoteFormPage is a custom property that links to another page which in turn contains a form, ie: we are fetching a form from another page)
EPiServer.XForms.XForm thisForm = new EPiServer.XForms.XForm(); // create a new XForm object
Guid thisGuid = new Guid(remoteFormPage.Property["MainXForm"].ToString()); // get the Guid of our target form
thisForm = EPiServer.XForms.XForm.CreateInstance(thisGuid); // instantiate our XForm as a copy of the one our Guid points to
bool bolVoted = false;
string sMyVote="";
foreach (EPiServer.XForms.XFormData thisFormData in thisForm.GetPostedData())
{ // for all votes
if (thisFormData.Sid == CurrentUser.Sid){ // compare the voter's SID with our current user
sMyVote = "On " + thisFormData.DatePosted + " you voted: " + thisFormData.GetValues().Get(0); // debug text
bolVoted=true; // they've voted before!
break; // no point continuing to check votes
}
}