Is it possible to post data from a form with controller rendering on page1 to a controller rendering on page2?
I mean the form submit on page1 should post back with page2 as page context.
Update 1: tried below option of adding scItemPath in route.. no luck
https://jockstothecore.com/to-the-controller-and-back-part-1-routing/
scItemPath passed in routevalues is appending to route like controller/action/{scItemPath}, but not invoking the pagecontext of item id passed.
Update 2: adding code
view (rendered using conroller rendering on item1)
@using (Html.BeginRouteForm(Sitecore.Mvc.Configuration.MvcSettings.SitecoreRouteName, new { scItemPath = "path/to/item2"}, FormMethod.Post, new { @name = "selectLoginCredentialsForm", @class = "adjacent_error_wrap", @enctype = "multipart/form-data" }))
{
@Html.AntiForgeryToken()
@Html.Sitecore().FormHandler("RegistrationSecurity", "SetSecurityDetails")
//form inputs
<input name="username" type=text/>
<input name="password" type=text/>
<input type="submit" value="submit"/>
}
Controller
public class RegistrationSecurityController : GlassController
{
public ActionResult SetSecurityDetails(UserCredentials creds)
{
var model = GetDataSourceItem<Idatasource>();
return View("~/Views/path/to/view.cshtml", model);
}
}