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

Forums / Developing with Sitefinity / Multiple MVC widgets that input data

Multiple MVC widgets that input data

2 posts, 0 answered
  1. Kevin
    Kevin avatar
    8 posts
    Registered:
    11 Dec 2012
    12 Feb 2013
    Link to this post

    Hi,

     I am running SiteFinity 5.3.  I have 2 MVC widgets that allow the user to enter search criteria to search for content on my site.  On my homepage I drag and drop the widgets on to the page.  So far so good.  2 search forms each with their own submit button.

    However, the controller for the second widget never gets called.  Regardless of which submit I click it is always the controller for the first form that gets called.

     I have tried changing the form name and action parameters in the Razor code in method @BeginFormSitefinity but these seem to be ignored.

    It looks like some clever JavaScript dynamically changes the action of final rendered form but I'm not sure how this works as I cannot see a form called "aspnetForm" declared on the page and is an undefined variable according to FireBug.

     Can anyone offer any guidance on this please?

     Thanks

     var sfMvcInputs = document.getElementById("rapidBookForm222").getElementsByTagName("input");
    var sfMvcInputsLen = sfMvcInputs.length;
    while(sfMvcInputsLen--) {
    typeAttr = sfMvcInputs[sfMvcInputsLen].getAttribute("type");
    if(typeAttr == "submit") {
    sfMvcInputs[sfMvcInputsLen].onclick = function() {
    document.forms["aspnetForm"].action = "/a-totally-different-page"";
    document.forms["aspnetForm"].method = "GET";  // changed to post for testing purposes
    document.forms["aspnetForm"].submit();

  2. Stanislav Velikov
    Stanislav Velikov avatar
    1113 posts
    Registered:
    18 Sep 2017
    15 Feb 2013
    Link to this post
    Hello,

    The first controller index action is always refereed to when the controls are on one page. This is a bug here is the bug in PITS.
    In the second widget if you redirect to another view the second widget will not be referring to the incorrect  ActionResult.

    Greetings,
    Stanislav Velikov
    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
2 posts, 0 answered