November Happy Hour will be moved to Thursday December 5th.

XForms - "Send to specific URL"

Vote:
 

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...

#49384
Mar 16, 2011 7:59
Vote:
 

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

#49385
Mar 16, 2011 8:02
Vote:
 

Hi Jonas,

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

#49386
Mar 16, 2011 8:15
Vote:
 

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...

#49387
Mar 16, 2011 8:18
Vote:
 

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.

#49388
Mar 16, 2011 8:21
Vote:
 

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...

#49402
Mar 16, 2011 10:32
Vote:
 

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.

#49403
Mar 16, 2011 10:44
Vote:
 

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.

#49404
Mar 16, 2011 10:50
Vote:
 

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 ;)

#49405
Mar 16, 2011 10:52
Vote:
 

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

#49406
Mar 16, 2011 10:55
Vote:
 

What a coincidence, I just found mine :)

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

#49407
Mar 16, 2011 10:56
Vote:
 

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?

#52126
Jul 07, 2011 13:10
Vote:
 

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.

#52129
Jul 07, 2011 13:30
Vote:
 

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.

#52142
Jul 08, 2011 7:09
Vote:
 

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>

#52144
Jul 08, 2011 7:24
Vote:
 

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

#52145
Jul 08, 2011 7:39
Vote:
 

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

#52153
Jul 08, 2011 12:52
Vote:
 

 

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?

 

 

#52154
Jul 08, 2011 13:01
Vote:
 

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

#52247
Jul 13, 2011 13:44
Vote:
 

ok.Thank you Linus......

#52250
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.