Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more

XForms showing page in wrong language after submission

Vote:
 

Hi,

 I'm having trouble with XForms on a site that has multiple languages. If "

I.e. the user is sent to www.thewebsite.com/services/  instead of  www.thewebsite.com/se/Tjanster/ 

#50559
May 04, 2011 14:04
Vote:
 

What version are you running? Think there was a bug on this in CMS 6.

#50560
May 04, 2011 14:27
Vote:
 

The site is running CMS 6. Do you know if this bug has been fixed in CMS 6 R2? Couldn't find anything addressing this issue

#50562
May 04, 2011 14:41
Vote:
 
#50563
Edited, May 04, 2011 14:55
Vote:
 
I had this problem once before and solved this with some coding in global.asax.cs. With some inspiration from the code below you might solve the problem.

protected void Application_Start(Object sender, EventArgs e)
{
XFormControl.ControlSetup += XForm_ControlSetup;
}

public void XForm_ControlSetup(object sender, EventArgs e)
{
XFormControl control = (XFormControl)sender;
control.AfterSubmitPostedData += new SaveFormDataEventHandler(XForm_AfterSubmitPostedData);
}

public void XForm_AfterSubmitPostedData(object sender, SaveFormDataEventArgs e)
{
var control = (XFormControl) sender;
if (control.FormDefinition.PageGuidAfterPost != Guid.Empty)
{
var pageMap = PermanentLinkMapStore.Find(control.FormDefinition.PageGuidAfterPost) as PermanentPageLinkMap;
if (pageMap != null)
{
var pageHandler = control.Page as PageBase;
if (pageHandler != null)
{
var redirectUrl = UriSupport.AddLanguageSelection(pageMap.MappedUrl.ToString(), pageHandler.CurrentPage.LanguageID);
control.Page.Response.Redirect(redirectUrl);
}
}
}
}

Regards
Joakim
#50564
May 04, 2011 14:59
Vote:
 

Thanks Joakim, your solution worked :)

#50565
May 04, 2011 15:11
Vote:
 

I'm almost 100% sure that I fixed that bug to the CMS 6 R2 release...

 

/Linus

#50574
May 04, 2011 16:05
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* 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.