Translated page Controller not fired

Vote:
 

Hi,

I am using Episerver 7.5 and I have a site that uses a Translated site too - using the Sites tab.

One of the Templates I have a button that posts back to a Controller (Index) to verify a user.

In the Default english page this works fine but when I swap language to Welsh and click the button it doesnt post back to the controller.

Is there a reason for this?

Jon

#178679
May 17, 2017 17:13
Vote:
 

What is action of the form? Does it include language segment?

#179036
May 30, 2017 9:27
Vote:
 

Hi,

This is the english (which is working)

 <form action="/get-in-touch/" method="post" novalidate="novalidate">

This is the welsh that is not working

<form action="/cy-GB/cysylltu-a-ni/" method="post" novalidate="novalidate">

This is all create created with this html in the page.

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

}

#179818
Edited, Jun 22, 2017 15:23
Vote:
 

This is the Controller mark up

public class GetInTouchFormController : PageControllerBase<GetInTouchForm>
    {
        [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 };
            

}
#179819
Jun 22, 2017 15:24
Vote:
 

What exacty is "cysylltu-a-ni" segment in Welsh form case?

#179846
Jun 22, 2017 23:22
Vote:
 

That is Welsh for get-in-touch - it is the translated page name. Is that the reason it is not posting back?

#179853
Jun 23, 2017 10:40
Vote:
 

So, just to be sure...

  • GET ir working for welsh page, but not the POST
  • "cy-GB" is enabled and you are able to browse other pages
  • page in Welsh is published and accessible
#179856
Jun 23, 2017 11:22
Vote:
 

Hi,

Yes that is correct.

If you would like to have a look at the UAT site it is here: https://uat.goconstruct.org/cy-gb/cysylltu-a-ni/

I hope it helps a bit - you can see the english version by either clicking English at the top of the page or browse here https://uat.goconstruct.org/get-in-touch/

Thanks for all your help

#179857
Jun 23, 2017 11:25
Vote:
 

I think I can see the issue there. The action on your form includes /cy-GB/ but it looks like you're redirecting URLs to their lower case equivalent so when you post to /cy-GB/cysylltu-a-ni/, it 301 redirects to /cy-gb/cysylltu-a-ni/.

It looks like that's an issue throughout the site so, for each page you request, the end user's browser will end up making 2 requests (the initial mixed case request and the redirected lower case request). You can fix that pretty easily in Episerver admin -> Config -> Manage Website Languages then clicking on your language and changing the web address prefix to cy-gb rather than blank or cy-GB.

#179863
Jun 23, 2017 15:01
Vote:
 

You know, to be honest - I've been able to submit the form back, but got 301 redirect as response. IMHO (looking at network tab) seems like this is related to lowercase redirects, because form is being posted to "/cy/GB/...", but got back redirect to "/cy-gb/...". You should check your redirection or canonical url rules.

Also, I was not aware that welsh is so different language compared to rest. Thanks for giving opportunity to realize it.

#179864
Jun 23, 2017 15:02
Vote:
 

You two guys are amazing - not even Episerver help desk could find this fix. That is perfect thank you both ever so much :)

#179867
Jun 23, 2017 15:19
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.