1

We are trying to create a Summary page for a multi-page Sitecore Form 9.3. Achieved the same by adding

  1. Custom Submit button as "Next" Action in which the submitted data is saved in session variable

  2. Custom form field which retrieves the session variable data and displays on next page .

The same works on Experience editor /CM role.

But does not work on website after publish.

Please advise.

Happy to consider any other alternative to create this capture and display the data on Summary page before submitting the same.

Regards,

Shilpy

2
  • When you say it does not work, please can you clarify what exactly is happening - is data not being saved in session or it is not being retrieved on the final step? Do you see any errors in Sitecore logs or browser console? Please also add code of your custom submit action and form field as a minimal reproducible example.
    – Anna Gevel
    Apr 25, 2023 at 11:46
  • I think you need to check on your CD server configuration. Apr 25, 2023 at 13:06

1 Answer 1

1

Managed to resolve this with the help of the Sitecore Support team. The solution was already working, one of the items in the Submit action was in workflow Draft state and was not getting published and breaking the whole functionality.

In brief solution for creating a Summary form:

  1. Create a Next Submit button with custom action:

    Something like this:

     protected override bool Execute(string data, FormSubmitContext formSubmitContext)
     {
             var formItem = Context.Database.GetItem(new ID(formSubmitContext.FormId));
             Dictionary<string, string> fielDictionary = new Dictionary<string, string>();
             foreach (var field in (formSubmitContext.Fields))
             {
                 fielDictionary.Add(field.Name, GetFieldValue(field));
             }
             System.Web.HttpContext.Current.Session["SubmittedSHUFormData"] = fielDictionary;
             return true;
     }
    
  2. On the Next page create a custom field to display the fields from session value. On its razor view - display the fields from the session variable.

    var submittedFields = (HttpContext.Current.Session["SubmittedSHUFormData"]) as Dictionary<string, string>; 
    

Reference:

  1. https://dipaksanki.wordpress.com/2020/06/08/custom-action-in-sitecore-9-3-forms/
  2. https://madhuanbalagan.com/generic-method-to-read-values-from-any-type-of-form-fields

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.