XForms on a page using 7.5

Vote:
 

Hi,

im trying to create a xForm on a page and have added the following code into it's type class:

 /// <summary>
        /// Gets or sets the form.
        /// </summary>
        /// <value>The form.</value>
        [Display(
            Name = "Form",
            Description = "A Simple Form builder.",
            GroupName = SystemTabNames.Content,
            Order = 1)]
        [CultureSpecific]
        public virtual XForm Schema { get; set; }

    On the page itself I have added the following:

 if (CurrentPage.Schema != null)
            {
                XFormControl.FormDefinition = CurrentPage.Schema;
                XFormControl.AfterSubmitPostedData += new SaveFormDataEventHandler(FormControl_AfterSubmitPostedData);
            }

    AND

 public void FormControl_AfterSubmitPostedData(object sender, SaveFormDataEventArgs e)
        {
            
            XFormControl control = (XFormControl)sender;
            var clone = e.FormData.Data.Clone();

            try
            {
                // EmailHelper.SendUserEmail(control.Data, CurrentPage);

                if (control.FormDefinition.PageGuidAfterPost != Guid.Empty)
                {

                    var pageMap = PermanentLinkMapStore.Find(control.FormDefinition.PageGuidAfterPost) as PermanentPageLinkMap;
                    if (pageMap != null)
                    {

                        control.Page.Response.Redirect(pageMap.MappedUrl.ToString());
                        return;
                    }
                }
             
              

            }

            catch (Exception ex)
            {
                throw ex;
                //Response.Write("ERROR" + ex.ToString());
            }

            //control.Controls.Clear();
            System.Web.UI.WebControls.Label label = new System.Web.UI.WebControls.Label();
         label.CssClass = "thankyoumessage";
            label.Text = "Thank you";
            control.Controls.Add(label);


        }

    AND the mark up:

 <XForms:XFormControl ID="XFormControl" runat="server" EnableClientScript="false"
            ValidationGroup="XForm" OnAfterSubmitPostedData="FormControl_AfterSubmitPostedData"
             />
        

    Yet, when setting the Submit button to either email - database or specific URL, and setting the page it needs to go to after submitting the form doesnt work - have I missed anything?

 

Jon

#81745
Feb 25, 2014 12:48
Vote:
 

Any body know the answer?

#81800
Feb 26, 2014 15:58
* 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.