+1-888-365-2779
Try Now
More in this section

Forums / Bugs & Issues / Adding form in widget changes where main form tag closes

Adding form in widget changes where main form tag closes

7 posts, 0 answered
  1. Stuart
    Stuart avatar
    33 posts
    Registered:
    01 Nov 2012
    30 Dec 2012
    Link to this post
    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
  2. Kristian Smilenov
    Kristian Smilenov avatar
    32 posts
    Registered:
    18 Mar 2015
    02 Jan 2013
    Link to this post
    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
  3. Stuart
    Stuart avatar
    33 posts
    Registered:
    01 Nov 2012
    02 Jan 2013 in reply to Kristian Smilenov
    Link to this post
    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
  4. Stoimen Stoimenov
    Stoimen Stoimenov avatar
    60 posts
    Registered:
    11 Jul 2016
    03 Jan 2013
    Link to this post
    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
  5. Stuart
    Stuart avatar
    33 posts
    Registered:
    01 Nov 2012
    03 Jan 2013 in reply to Stoimen Stoimenov
    Link to this post

    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. 

  6. Stoimen Stoimenov
    Stoimen Stoimenov avatar
    60 posts
    Registered:
    11 Jul 2016
    04 Jan 2013
    Link to this post
    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.

    http://www.sitefinity.com/documentation/documentationarticles/developers-guide/sitefinity-essentials/how-does-sitefinity-use-asp.net-mvc/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
  7. Stuart
    Stuart avatar
    33 posts
    Registered:
    01 Nov 2012
    07 Jan 2013 in reply to Stoimen Stoimenov
    Link to this post
    Hi Stoimen,

    That fixed that. Thanks for the help!

    Stuart
7 posts, 0 answered