1

I have one Sitecore Form to be used across multiple sites for which I want to configure respective thankyou pages (route might be different for individual site) at rendering parameter. So Is there a possibility of reading Mvc Form Rendering parameter value in Custom Submit Action method or any alternative to achieve ?

enter image description here

Because in Custom Submit Action while reading rendering parameter is always Null. RenderingContext.Current.Rendering.Parameters["RedirectUrl"]

Thankyou.

1 Answer 1

2

The possible case can be creating a custom field. You can create a custom field that will be a copy of a hidden field and here you can get the rendering parameters and assign it to the hidden field.

So your view will be something like this.

@using System.Web.Mvc.Html
@model Site.Feature.Forms.Forms.Controls.HiddenField.HiddenFieldModel

{
  var parms = renderingContext.Rendering.Parameters;
  var renderingParamValue = parms["name of the field here"];
}

<input type="hidden" id="@Html.IdFor(m => Model.Value)" name="@Html.NameFor(m => Model.Value)" value="@renderingParamValue" />

In this way you can assign the rendering parameter value to the hidden field and you will get it to your custom submit action.

For more information about creating custom hidden field refer to this

Hope this helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.