Adding form in widget changes where main form tag closes

Posted by Community Admin on 04-Aug-2018 16:19

Adding form in widget changes where main form tag closes

All Replies

Posted by Community Admin on 30-Dec-2012 00:00

Hi,

Currently, we have a masterpage with structure as below:
<body>
    <form>
        <header></header>
        ...stuff...
        <footer></footer>
    </form>
</body>

However, when I add a form in an MVC widget to a page, the structure changes to this:
<body>
    <form>
        <header></header>
        <SitefinityContent></SitefinityContent>
    </form>
    <footer></footer>
</body>

The structure above is explicitly stated in the master page and no changes are made to it when rendering the widget. Is there any way to keep the </form> from closing early? 

Thanks,
Stuart

Posted by Community Admin on 02-Jan-2013 00:00

Hello

Stuart,

I am not able to reproduce this issue on clean project. Can you please give me more information about the widget and the master page? It will be great if you can send them to me, so that i can test it locally. 

Thank you for your cooperation.

Greetings,
Kristian Smilenov
the Telerik team
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 02-Jan-2013 00:00

Hi Kristian,

I ended up removing the form @using(Html.form()) that I had in MVC and just submitting the form that encompasses the entire body. I had to access the fields by name because there are some hidden fields that Sitefinity or ASP.NET apparently use, and it seems to be working. I am still curious about the issue though; how would I send you my files? If we ever need a more complex form, or a form that submits to a remote site, it might not be possible to rely on that 'body form' to automatically submit to the right place with the right fields.

Thanks,
Stuart

Posted by Community Admin on 03-Jan-2013 00:00

Hello Stuart,

Please have a look at http://www.sitefinity.com/documentation/documentationarticles/developers-guide/sitefinity-essentials/how-does-sitefinity-use-asp.net-mvc/three-mvc-modes/hybrid-mode

Instead of @Html.BeginForm you should be using @Html.BeginSitefinityForm. Try with that one and you shouldn't have problems with it.

However it will be best if you could submit a support ticket with your master page. In the support ticket we can provide you with out FTP server where you can upload your files.

Greetings,
Stoimen Stoimenov
the Telerik team

Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 03-Jan-2013 00:00

Hi Stoimen,

Is there a using statement or reference that I need to add so that @Html.BeginSitefinityForm is available?

I'm getting a System.Web.Mvc.HtmlHelper does not contain a definition for @Html.BeginSitefinityForm. 

Posted by Community Admin on 04-Jan-2013 00:00

Hi Stuart,

You need to reference Telerik.Sitefinity.UI.MVC in your views.

@using Telerik.Sitefinity.UI.MVC

But note that "BeginFormSitefinity" is used only in hybrid mode.

www.sitefinity.com/.../three-mvc-modes


Regards,
Stoimen Stoimenov
the Telerik team
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 07-Jan-2013 00:00

Hi Stoimen,

That fixed that. Thanks for the help!

Stuart

This thread is closed