10

I have a WFFM form with a hidden field on it. The field contains a value that I would like to know on the success page - in order to use it in custom code in a rendering or even for personalization.

Is there a way to pass data from the form to the success page? Maybe by changing the redirect url and add a querystring...

Using MVC forms in v8.1.

2
  • It appears that the successAction pipeline that deals with the success page redirect doesn't have access to the form entries. Is the data you're trying to capture something you could consider adding to the user profile? Oct 4, 2016 at 23:53
  • The successAction pipeline is for webforms, mvc uses another one...
    – Gatogordo
    Oct 6, 2016 at 8:50

2 Answers 2

2

It appears that the pipeline has changed between webforms and MVC. The Success pipeline for MVC is <wffm.success> and can be found in Sitecore.MvcForms.config. Through this you have access to the FormModel

public class SuccessRedirect : FormProcessorBase<IFormModel>
{
    public override void Process(FormProcessorArgs<IFormModel> args)
    {
        Assert.ArgumentNotNull((object)args, "args");
        var model = args.Model as FormModel;
        if (model == null)
            return;
        model.SuccessRedirectUrl = model.SuccessRedirectUrl + "?val=" + model.Results[0].Value;
    }
 }

Check out http://ggullentops.blogspot.com.au/2016/07/sitecore-wffm-act-on-success.html for more information and some options on customising post-success actions.

2

There is a good post here on it here from Mike Reynolds:

https://sitecorejunkie.com/2014/06/14/show-submitted-web-forms-for-marketers-form-field-values-on-a-confirmation-page-in-sitecore/

There are a lot of steps though to this approach. You may find it better to save them before redirecting instead as suggested by JammyKam here:

https://stackoverflow.com/questions/31957098/sitecorewffm-custom-error-message-with-details-on-same-page-with-form

-- UPDATE ---

If you don't want to go for either of these approaches you could try creating a custom save action with a Success Redirect. However I've not tested if you can get the form values from args.Form or not.

https://seitenkern.com/2015/08/03/web-forms-for-marketers-wffm-%E2%80%92-part-3-%E2%80%92-multipart-form-and-a-custom-save-action/

Or here:

https://gist.github.com/PetersonDave/5096452

There is another good example here that might be useful:

https://petersondave.wordpress.com/2013/10/10/trigger-google-analytics-events-on-sitecore-web-forms-for-marketers-submit-actions/

2
  • Nice solution if I need multiple or complex values, but isn't there a way to pass a simple value (just an id) without going through the trouble of saving it?
    – Gatogordo
    Oct 5, 2016 at 7:23
  • Gatogordo - I've updated my answer above to include some further options for you. They are untested though. Oct 5, 2016 at 10:14

Your Answer

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

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