Hi Jonas,
Have you hooked yourself into the XForm's AfterSubmitPostedData event? And if you have, what does your method look like?
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...
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));
control.Page.Response.Redirect(redirectPage.LinkURL);
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);
}
Then the control.Page.Response.Redirect(redirectPage.LinkURL); line should redirect you after you have posted.
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...
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.
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.
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 ;)
On the bright side, it's a great subject for my blog on EPiServer World :)
What a coincidence, I just found mine :)
Don't worry though, not going to steal yours.
what is FormDefinition in <XForms:XFormControlID="XFormID"FormDefinition=""runat="server"> what value i have to specify? if i give some value in double quotations......it is not accepting saying that it is string thats y......how can i rectify this error in source window?
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;
DataBind();
Make sure you have a property named XForm on your page.
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 (http://msdn.microsoft.com/en-us/library/system.net.webclient.aspx) to post the data to the URL.
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?
XForms:XFormControlrunat="server"ValidationGroup="XForm"EnableClientScript="true"ID
="id_xform">
<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>
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.
Regards
Linus Ekström
EPiServer Development Team
@Linus: That option did not meet my requirements so i solved it another way 3 months ago :)
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
<EPiServer:PropertyID="xformproperty"runat="server"PropertyName="XFormprop"/>
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?
Response keyword is not working in Global.asax file.......then how can i display the value entered by the user in Textbox control?
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...