Strange one this. I've got a form with a Name and Email field setup. This gets submitted into Contour and then the page redirects to my user control page with the recordid as a query string param.
So far so good. Now I am trying to access the submitted data based upon the recordid so I pass into the following method:
publicstring ConvertRecord(string recordID)
{
// for testing only//recordID = "bf986387-566d-4743-aa78-6bbaacaeb59f";if (recordID != "")
{
RecordStorage rs = newRecordStorage();
Record r = rs.GetRecord(newGuid(recordID));
RecordsViewer viewer = newRecordsViewer();
XmlNode xml = viewer.GetSingleXmlRecord(r, new System.Xml.XmlDocument());
string email = "";
string name = "";
foreach (KeyValuePair<System.Guid, Umbraco.Forms.Core.RecordField> field in r.RecordFields)
{
if(email == string.Empty)
email = field.Value.Values[0].ToString();
else
name = field.Value.Values[0].ToString();
}
return name + "," + email;
}
returnstring.Empty;
} What it should do is give me a string in the format "simon steed,[email protected]".
The problem is sometimes it does, sometimes it doesnt. I am getting strange things like the email and name are swapped around. How can I stop this or is there a better way to get this data?
Contour records randomly swapping over
Strange one this. I've got a form with a Name and Email field setup. This gets submitted into Contour and then the page redirects to my user control page with the recordid as a query string param.
So far so good. Now I am trying to access the submitted data based upon the recordid so I pass into the following method:
Nobody tried doing anything like this before?
Comment author was deleted
And does the data get stored properly or also getting the swap effect there?
Comment author was deleted
Think you should just add an additional check to get the correct field first (based on the caption)... since now it's just based on the order
Hi Tim - Data seems to be stored correctly so not worried there, just randomly returns alternate data on different calls to get the record.
I was originally wondering if there was a better way to get at the data, I guess i'm using the correct methods then?
I'll try adding some additional logic, cheers :-)
is working on a reply...