Join us this Friday for AI in Action at the Virtual Happy Hour! This free virtual event is open to all—enroll now on Academy and don’t miss out.

 

Bespoke form not posting when in a different language

Vote:
 

Hi,

I have a bespoke form in 7.5 and it works well in english but it never posts when in a different langauge for example:

testsite.com/myform works in English - notice there is no language path in the URL as en is the default language set in the CMS

but testsite.com/cy-GB/myform does not hit the Controller - it just refreshes the page.

This is my HTML:

 @using (Html.BeginForm("Index", "GetInTouchForm", new { language = ContentLanguage.PreferredCulture.Name }, FormMethod.Post))
                {

}

and this is my Controller:

public class GetInTouchFormController : PageControllerBase
    {
        [HttpGet]
        public ActionResult Index(GetInTouchForm currentPage)
        {
            var model = new GetInTouchFormModel(currentPage);
            return View(model);
        }

        [HttpPost]
        [ValidateAntiForgeryToken]
        public ActionResult Index(GetInTouchForm currentPage, GetInTouch CustomForm)
        {
            var model = new GetInTouchFormModel(currentPage) { CustomForm = CustomForm };

}

I have put this in my Global but it didnt resolve the issue:

        protected override void RegisterRoutes(RouteCollection routes)
        {
            base.RegisterRoutes(routes);
            routes.MapRoute("submit", "{language}/{controller}/{action}", new { action = "Index" });
            routes.MapRoute("default", "{controller}/{action}", new { action = "index" });
            
           
        }

Any ideas?

Thanks for your help,

Jon

[Pasting files is not allowed]

#179807
Jun 22, 2017 12:35
Vote:
 

I think we can close this one...

#179887
Jun 24, 2017 7:09
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.