Try our conversational search powered by Generative AI!

XForms - "Send to specific URL"


Hi Xform-gurus :)

What do i have to do to make the feature "Send to specific URL" work? My XForms work well with mail and/or save to database. The one thing that dosen't work is the one i really need...

Mar 16, 2011 7:59

...and i mean "specified URL" and not "Specific URL".

Mar 16, 2011 8:02

Hi Jonas,

Have you hooked yourself into the XForm's AfterSubmitPostedData event? And if you have, what does your method look like?

Mar 16, 2011 8:15

My XForm events in global.asax.cs are "out of the box", which might be the issue :) The probelm is i'm not really sure what i'm suppose to add...

Mar 16, 2011 8:18

I guess yours looks like this right?


public void XForm_AfterSubmitPostedData(object sender, SaveFormDataEventArgs e)
XFormControl control = (XFormControl)sender;

if (control.FormDefinition.PageAfterPost != 0)
PageData redirectPage = DataFactory.Instance.GetPage(new PageReference(control.FormDefinition.PageAfterPost));

//After the form has been posted we remove the form elements and add a "thank you message".
Label label = new Label();
label.CssClass = "thankyoumessage";
label.Text = LanguageManager.Instance.Translate("/form/postedmessage");

Then the control.Page.Response.Redirect(redirectPage.LinkURL); line should redirect you after you have posted.

Mar 16, 2011 8:21

Isnät it suppose to post the xform to the specified URL, instead of saving it to database? I can't se how a redirect in AfterPost can send the form data to an external page...

Mar 16, 2011 10:32

Oh sorry! My mistke :)

You can access the property e.FormData.CustomUrl to get your post url. Then you post the data to that service or what you now have.

Mar 16, 2011 10:44

Thanks, i'll look into that. I'm afraid it's a lot of work for me. As far as i know, there's no way to get the content of labels in xform, other then parsing the XML? And i really need to get my hans on both content of input fields, and content of labels and then pass it on to en external URL.

Mar 16, 2011 10:50

Nope, you must parse the XML. Thankfully you do have XDocument which is a handy class for traversing XML documents. It's a tough job but some one has to do it ;)

Mar 16, 2011 10:52

On the bright side, it's a great subject for my blog on EPiServer World :)

Mar 16, 2011 10:55

What a coincidence, I just found mine :)

Don't worry though, not going to steal yours.

Mar 16, 2011 10:56

what is FormDefinition in <XForms:XFormControlID="XFormID"FormDefinition=""runat="server"> what value i have to specify? if i give some value in double is not accepting saying that it is string thats can i rectify this error in source window?

Jul 07, 2011 13:10

I think you enter the name of your form property.

Otherwise, addthis control to your page.
<xforms:xformcontrol ID="FormControl" runat="server" EnableClientScript="true" ValidationGroup="XForm" />

And then this code in Page Load or something.
PropertyXForm Form = CurrentPage.Property["XForm"] as PropertyXForm;
FormControl.FormDefinition = Form.Form;

Make sure you have a property named XForm on your page.

Jul 07, 2011 13:30

Hi Jonas!

The "post to URL" option is supposed to create a normal post from the server with the values of the form to the specified URL. Are you not getting this or do you have problem with the actual posted data to the URL? I don't think that this option is used very much but behind the scenes it uses a WebClient ( to post the data to the URL.

Jul 08, 2011 7:09

hi guys i am new to episerver as well as XForms.....,

my code regarding to XForms in .aspx is like below.....but in episerver page it is not displaying the label controls and it is not displaying the button with specified width and caption on button.why like this? any sol for this issue?




<table><tr><td><XForms:LabelHeight="50"Width="50"ID="lbluname"Visible="true"runat="server"BorderWidth="10"Value="USERNAME"></XForms:Label></td><td><XForms:InputID="id_uname"ToolTip="Enter your username"runat="server"></XForms:Input></td></tr>


<tr><td><XForms:LabelID="lblemailid"Visible="true"runat="server"Value="EMAILID"></XForms:Label></td><td><XForms:InputID="id_email"ToolTip="Enter your emailid"runat="server"></XForms:Input></td></tr>


<tr><td><XForms:LabelID="lblcmt"runat="server"Value="COMMENTS"></XForms:Label></td><td><XForms:TextAreaID="id_cmt"ToolTip="Enter your username"runat="server"></XForms:TextArea></td></tr>


<tr><td><XForms:SubmitID="id_submit"Value="SUBMIT"Enabled="true"ToolTip="Click to submit your commment"runat="server"Height="500"Width="5010"></XForms:Submit></td><td><XForms:SubmitID="Submit1"ToolTip="Click to cancel"runat="server"></XForms:Submit></td></tr></table></XForms:XFormControl>

Jul 08, 2011 7:24

Hi Murali!

XForms are used to present and work with forms that are created by the editors in the user interface. The XForms control is connected to a form, usually by a property that defines which form to use. If you want to create a regular web form I suggest that you use the standard asp.NET web controls instead.

Linus Ekström
EPiServer Development Team

Jul 08, 2011 7:39

@Linus: That option did not meet my requirements so i solved it another way 3 months ago :)

Jul 08, 2011 12:52


Hi Linus,

I created one XFORM with two textboxes,one textarea for commenting,two buttons.And i wrote the code in source window like below


Now i want to access those control values in code window. I tried so much on that issue but invain. Is there any way to overcome this?



Jul 08, 2011 13:01

Response keyword is not working in Global.asax file.......then how can i display the value entered by the user in Textbox control?

Jul 13, 2011 13:44

ok.Thank you Linus......

Jul 13, 2011 14:00
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.