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

Forums / Developing with Sitefinity / MVC form widget on master page

MVC form widget on master page

2 posts, 0 answered
  1. Susan
    Susan avatar
    1 posts
    Registered:
    13 Apr 2015
    16 May
    Link to this post

    We created an MVC form widget that is being used for a custom search form. When it is added to the search page the form displays and submits as expected.

    However, we would also like this form to be displayed on all pages so we added it to the shell template for the site. When the form is placed here, it displays correctly but when hitting the submit button it only does a post back of that page.

    Looking at the generated html, the form tag around the input and buttons is not being rendered so it seems like the submit button is instead triggering the submit for the page level form created from the webform.

    I've tried giving the MVC form a unique id as well as changing the submit button to a standard button and using jquery to trigger the form submit but nothing seems to have worked.

    Is there something else that needs to be done to have this widget be recognized as a separate form?

    Thanks!

  2. Velizar Bishurov
    Velizar Bishurov avatar
    143 posts
    Registered:
    01 Dec 2016
    19 May
    Link to this post
    Hello,

    When creating the form's markup you have to use @Html.BeginFormSitefinity instead of @Html.BeginForm as stated in the following documentation article: http://docs.sitefinity.com/for-developers-mvc-modes#mode-comparison-table

    The @Html.BeginFormSitefintiy helper handles form submissions correctly when the widget is placed on a hybrid page or page template.

    Regards,
    Velizar Bishurov
    Telerik
     
    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 Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
2 posts, 0 answered