/// <summary> /// Handles the AfterSubmitPostedData event of the XFormControl. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EPiServer.XForms.WebControls.SaveFormDataEventArgs"/> instance containing the event data.</param> public void XForm_AfterSubmitPostedData(object sender, SaveFormDataEventArgs e) { XFormControl control = (XFormControl)sender; if (control.FormDefinition.PageGuidAfterPost != Guid.Empty) { PermanentPageLinkMap pageMap = PermanentLinkMapStore.Find(control.FormDefinition.PageGuidAfterPost) as PermanentPageLinkMap; if (pageMap != null) { string internalUrl = pageMap.MappedUrl.ToString(); internalUrl = UriSupport.AddLanguageSelection(internalUrl, ContentLanguage.PreferredCulture.Name); UrlBuilder urlBuilder = new UrlBuilder(internalUrl); //Rewrite the url to make sure that it gets the friendly url if such a provider has been configured. Global.UrlRewriteProvider.ConvertToExternal(urlBuilder, null, Encoding.UTF8); //Always cast UrlBuilders to get a correctly encoded url since ToString() is for "human" readability. control.Page.Response.Redirect((string)urlBuilder); return; } } //After the form has been posted we remove the form elements and add a "thank you message". control.Controls.Clear(); Label label = new Label(); label.CssClass = "thankyoumessage"; label.Text = LanguageManager.Instance.Translate("/form/postedmessage"); control.Controls.Add(label); }
/// <summary> /// Handles the AfterSubmitPostedData event of the XFormControl. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EPiServer.XForms.WebControls.SaveFormDataEventArgs"/> instance containing the event data.</param> public void XForm_AfterSubmitPostedData(object sender, SaveFormDataEventArgs e) { XFormControl control = (XFormControl)sender; if (control.FormDefinition.PageGuidAfterPost != Guid.Empty) { PermanentPageLinkMap pageMap = PermanentLinkMapStore.Find(control.FormDefinition.PageGuidAfterPost) as PermanentPageLinkMap; if (pageMap != null) { control.Page.Response.Redirect(pageMap.MappedUrl.ToString()); return; } } //After the form has been posted we remove the form elements and add a "thank you message". control.Controls.Clear(); Label label = new Label(); label.CssClass = "thankyoumessage"; label.Text = LanguageManager.Instance.Translate("/form/postedmessage"); control.Controls.Add(label); }