hi, I have surface controller and partial inside partial with a form. form submit does not hit the coding for action insode controller. and the submit button click redirect browser to surface/controller/….
How to fix this with out ajax call ?
I have tried return redirect(/pageurl/?xxxxxx) or return currentumbracopage() does not work.
@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage
<h2>Hello world from the outer partial </h2>
@await Html.PartialAsync("TestInnerPartial/TestInnerPartial")
Which renders:
@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage
<h2>Hello world from the INNER partial </h2>
@using (Html.BeginUmbracoForm<MySurfaceController>("HandleSubmit"))
{
<input type="submit" />
}
And the surface controller -
public class MySurfaceController : SurfaceController
{
public MySurfaceController(
IUmbracoContextAccessor umbracoContextAccessor,
IUmbracoDatabaseFactory databaseFactory,
ServiceContext services,
AppCaches appCaches,
IProfilingLogger profilingLogger,
IPublishedUrlProvider publishedUrlProvider)
: base(umbracoContextAccessor, databaseFactory, services, appCaches, profilingLogger, publishedUrlProvider)
{
}
[HttpPost]
[ValidateUmbracoFormRouteString]
public IActionResult HandleSubmit()
{
return RedirectToCurrentUmbracoPage();
}
}
Seems to render the form correctly and hitting submit redirects back to the page… what is different from what you have?