Subtotal: $37,477.00
Can we use SOAP to communicate with a web service upon submit? The scenario is that someone registers, and the registration gets logged in another system for action.
HTTP Post action is just plain POST Request. If you're SOAP service can work with a simple POST then it should work fine. There is nothing in HTTP Post action to support a SOAP API.
Remember, you can always create your own Live Forms Extensions. The process is not documented but it's fairly easy to create one. Here's a sample class. Execute method is called after form is submitted.
MyExtension.cs
public class MyExtension : IAction, IExtension { public MyExtension() { this.ActionType = "ServerSide"; } public string ActionType { get; set; } public ActionResult Execute(Control FormControl, HttpContext Context, PortalSettings PortalSettings, FormInfo Form, Submission SubmissionInfo) { ActionResult result = new ActionResult(); result.ResultType = ActionResult.ResultTypes.Success; return result; } public string FriendlyName { get { return "My Extension"; } } private string _ActionName; public string ActionName { get { return _ActionName != null ? _ActionName : Category + " > " + FriendlyName; } set { _ActionName = value; } } public string Category { get { return "My Extensions"; } } string IExtension.DesignControlPath { get { return "DesktopModules/LiveForms/Extensions/Actions/Submission/MyExtension/Design.ascx"; } } string IExtension.DesignResourcePath { get { return "DesktopModules/LiveForms/Extensions/Actions/Submission/MyExtension/App_LocalResources/Design"; } } public string RuntimeVersion { get { try { return System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); } catch { } return "1.0.0"; } } }
Remember, you will also need to create the Design.ascx so you can actually add the action to the form:
Design.ascx
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Design.ascx.cs" Inherits="Mandeeps.DNN.Modules.LiveForms.Extensions.MyExtension.Design" %> <%@ Register TagPrefix="dnn" TagName="Label" Src="~/controls/Labelcontrol.ascx" %> <%@ Register TagPrefix="LF" TagName="ConditionControl" Src="~/DesktopModules/LiveForms/UI/Design/Actions/Conditions.ascx" %> <div class="LiveForm"> <table style="float: right"> <tr> <td> <dnn:Label runat="server" ResourceKey="lActionName" /> </td> <td> <asp:TextBox runat="server" class="sfcommon" EnableViewState="true" ID="tbActionName"></asp:TextBox> </td> </tr> </table> <table style="width: 100%;"> <tr> <td colspan="2"> <div class="caption"> <asp:Label ID="lConditionInfo" runat="server" Resourcekey="lConditionInfo" /> </div> <LF:ConditionControl ID="CConditionSet" runat="server"></LF:ConditionControl> </td> </tr> <tr> <td colspan="2"> <asp:LinkButton ID="bSave" ResourceKey="bSave" CssClass="mbutton" runat="server" OnClientClick="return Conditions.IsValid('bSave');" OnClick="bSave_Click"></asp:LinkButton> <asp:LinkButton ID="bBack" Text="" CssClass="mbutton2" ResourceKey="bCancel" runat="server" OnClick="bBack_Click"></asp:LinkButton> </td> </tr> </table> </div>
Design.ascx.cs
public partial class Design : ExtensionDesign { string GUID = null; protected new void Page_Load(object sender, EventArgs e) { base.Page_Load(sender, e); Initialize(); } private void Initialize() { //Setup Conditions Control CConditionSet.ModuleId = ModuleId; CConditionSet.PortalId = PortalId; //Check if we're working with existing action if (!string.IsNullOrEmpty(Request.QueryString["guid"])) GUID = Request.QueryString["guid"]; //Update Text Labels if (GUID == null) bSave.Text = Localization.GetString("bSave.Text", LocalResourceFile); else bSave.Text = Localization.GetString("bUpdate.Text", LocalResourceFile); //Bind Existing Action Data BindData(); } public void BindData() { if (GUID != null) { ConditionalActions ca = Form.Actions.Where(a => a.GUID == GUID).SingleOrDefault(); if (ca != null) { MyExtension mext = ca.Actions[0] as MyExtension; if (!IsPostBack) { tbActionName.Text = mext.ActionName; } } } } protected void bSave_Click(object sender, EventArgs e) { MyExtension mext = new MyExtension(); //Validate Conditions string validate = LiveFormController.Forms.IsValidateCondtion(Form, c, CConditionSet.GetConditionSet(""), GUID, tbActionName.Text); if (validate == null) { //Validate Form if (IsValidated()) { if (Form != null) { ConditionalActions ca = Form.Actions.Where(a => a.GUID == GUID).SingleOrDefault(); if (ca != null) { mext = ca.Actions[0] as MyExtension; mext.ActionName = tbActionName.Text; ca.ConditionSet = CConditionSet.GetConditionSet(ca.GUID); } else { mext.ActionName = tbActionName.Text; ca = new ConditionalActions(mext); ca.ConditionSet = CConditionSet.GetConditionSet(ca.GUID); Form.Actions.Add(ca); } LiveFormController.Forms.UpdateForm(ModuleId, Form); } bBack_Click(this, null); } } else { Skin.AddModuleMessage(this, validate, DotNetNuke.UI.Skins.Controls.ModuleMessage.ModuleMessageType.YellowWarning); } } protected void bBack_Click(object sender, EventArgs e) { if (PortalSettings.EnablePopUps) LiveFormController.Forms.ShowDnnModalPopUp(this.Page, this.ReturnURL); else Response.Redirect(LiveFormController.Forms.GetUrl(this.ReturnURL)); } private bool IsValidated() { //Validate UI return true; } }
You may use the following to get the response for each field:
LiveFormController.Forms.ReplaceGUIDWithValue(Form, "[Token]", SubmissionInfo, ReplaceDNNStandardTokens);
Where "[Token]" is the actual token of the field. You may also pass the GUID of the Field instead of Token.
You can also get to all the Fields in the form using this: foreach (Fields.Field item in Form.Fields) { item.GUID; }
Your browser doesn't have Flash, Silverlight or HTML5 support.
This example is lacking an example of how to read the details saved when saving the action to Live Forms, as well as reading from the form after submission. Do you happen to have an updated version of this example code?
Thank you! I ran across this answer today and it is exactly what we are looking for.
Great stuff. Thanks, Mandeep! :)
Hello Will,
Do you complete this implementation ? I have the same requirement
I did, but I ended up using a different method of implementation instead of this integration due to how the page lifecycle and redirects execute.