I need to output the contents of the SubmittedFormField table as XML so that an external system can parse it. However, I don't seem to be able to write XML tags out in the template because I'm declaring the document type as XML:
<?xml version="1.0" encoding="UTF-8"?>
...and the browser is seeing
<% control OutputXML %>
as malformed XML tags. I'm thinking there's probably some sort of built in method to do this in Silverstripe? I'll also need to customize the tags that go around the name/value pairs in the SubmittedFormField table. How do you output XML to the front end in SS?
Yeah thanks but not really much help. @Willr, the main problem I am having is that each FIELD is a different record rather than each SUBMISSION being a different record. Regardless of whether I return it to the browser as a DataObjectSet somehow XML-ized or whether I return it as a string, there is no way for me to specify a new ID in the code each time I reach a new submission in the recordset. See below for example:
@Willr, the main problem I am having is that each FIELD is a different record rather than each SUBMISSION
Well yes, the module has to store each answer as it's own object since the number of submissions changes based on a form. If you want a unique ID for the XML then you can use the SubmittedForm ID. That will be unique and each field will have one.
Thanks @willr. Ok, I see now why you've modeled the data in this way - in order to turn it "on its side," as it were, you'd have to know how many fields the user added to the form. So I am getting my resultset like this:
SELECT SFF.ParentID, SFF.Title, SFF.Value, EFF.XMLExportTagName AS TagName FROM SubmittedFormField SFF
JOIN SubmittedForm SF ON SFF.ParentID = SF.ID
JOIN EditableFormField EFF ON SFF.Name = EFF.Name
ORDER BY SFF.ParentID ASC
And I'll just have to shuffle them around in PHP. Thanks again for your help.