XForms, how to | Episerver Developer Community

XForms, how to

Member since: 2007
 

Hi

Im trying to change the XHTML appearence of the form, what I do is:

In the OnInit -method, Im using the event : MyFormControl.ControlsCreated

In my event I extract all form controls with MyFormControl.ExtractXFormControls

Executes : FormControl.Controls.Clear();

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.

Thanks !

#19173 Mar 28, 2008 12:49
  • Member since: 2001
     

    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. 

    /Steve

    #19188 Mar 29, 2008 13:53
  • Member since: 2009
     

    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:

    <xforms:input ....><xforms:label...></xforms:label></xforms:input>

    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!

    br 

    Jørgen 

     

    #29649 May 07, 2009 15:56
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
Please login to post a reply