Including a Sitefinity form in a custom control

Posted by Community Admin on 04-Aug-2018 11:05

Including a Sitefinity form in a custom control

All Replies

Posted by Community Admin on 17-Aug-2012 00:00

Hi

I am trying to build a custom control that shows a list of competitions, along with their details, an application form and then a thank you page.

My custom control consists of a mutliview control with the 4 pages as views inside it.

Ideally, when the CMS user creates a competition, they will be able to point at a previously created Sitefinity form somehow, and then this gets rendered by my control, and functions like the form would on a normal page, saving the data away and then redirecting to a thank you URL that would be set dynamically.

Is this even possible, if not any suggestions on how I could fake it or do it another way?

This is my first project with Sitefinity, so if any of the veteran users can suggest a better way rather than using one usercontrol with a multiview, I am open to suggestions.

Regards,
David

Posted by Community Admin on 21-Aug-2012 00:00

Cheeky bump of this post to see if anyone has any thoughts please!

Posted by Community Admin on 21-Aug-2012 00:00

Possible solution mentioned by Sitefinity support here
www.sitefinity.com/.../how-to-get-form-control-ordinal-position-on-page.aspx

However it refers to RenderFormFields() in Telerik.Sitefinity.Modules.Forms.Web.UI.FormsControl, which I can't find anywhere.

Can anyone help?

Andy

Posted by Community Admin on 22-Aug-2012 00:00

I cant see why this wouldn't work...

Go to the settings toolbox (in advanced) and get the type of control the forms control uses.  Then use JustDecompile to find out the properties of the control, it probably accepts the Guid of the form to render.

Then just link it in like any other control with the prefix and controlname

Posted by Community Admin on 22-Aug-2012 00:00

Hi Steve

Thanks to your post, while not the exact solution, led me to the solution that works for me, of which is posted below for posterity.

In the custom user control regsiter the assembly "Telerik.Sitefinity" and the namespace is "Telerik.Sitefinity.Modules.Forms.Web.UI". 

This gives you access to the FormsControl control which does all the forms bits you would expect, including a Guid FormId property.

Thanks,
David

Posted by Community Admin on 22-Aug-2012 00:00

Yeah sorry, typed it on my ipad, didn't have JD with me to dig in deeper :)

This thread is closed