Vulnerability in EPiServer.Forms
Im trying to change the XHTML appearence of the form, what I do is:
In the OnInit -method, Im using the event : MyFormControl.ControlsCreated
Then I loop through the List<>>XFormControlBase>, builds up a "div" / input structure, and add this to the FormControl.Controls -collection.I appears fine, but when I press the submit button, nothing seems to work as it should, what am I doing wrong, is there any good example where this is done ??When Im doing as above, this error accours:An error has occurred because a control with id 'ctl00$fullPageSection$FormControl$ctl00' could not be located or a different control is assigned to the same ID after postback. If the ID is not assigned, explicitly set the ID property of controls that raise postback events to avoid this error.
Are you testing for postback when you create the control hierarchy? You need to do this on postback too.
What about changing the xform xml in the BeforeLoadingForm event? LoadFormEventArgs will contain the xform xml in the FormDefinition member.
I've tried to, and have been somewhat successfull in doing this through the method you refer to, Steve, though with the "Can I edit the appearance of a form?" section of this article as a guide.
I've successfully substituted all table, tbody, tr and td tags with divs, and through xmldocument manipulation added some class names to row-divs.
However I've also tried to add html around the label tag and the input tag respectively. The Xml looked like this:
What I did was this:
<xforms:input ....><div ...><xforms:label...></xforms:label></div></xforms:input>
but when the form is ultimately written into the document, there is no trace of my added div.
Im really unsure of where the xml gets translated into pure html, but what I am hoping is that there is some other event i can hook into to be able to inspect and modify the finished html just as it is being written into the html stream.
Any suggestions are most welcome!