Multiple MVC widgets that input data

Posted by Community Admin on 04-Aug-2018 17:24

Multiple MVC widgets that input data

All Replies

Posted by Community Admin on 12-Feb-2013 00:00

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();

Posted by Community Admin on 15-Feb-2013 00:00

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

This thread is closed