A critical vulnerability was discovered in React Server Components (Next.js). Our systems remain protected but we advise to update packages to newest version. Learn More

Pawan Singh
Jul 21, 2025
  525
(0 votes)

Optimizely Forms: Forcing New Submission on Every Post

By default, Optimizely Forms uses browser cookies to track submissions and updates the existing submission if the same user submits the form again. While this behavior works well in most scenarios, we had a custom business requirement: for certain forms, each submission needed to be treated as a new entry, regardless of whether it came from the same user or browser session. At the same time, all other forms in the solution were expected to retain the default cookie-based behavior.

Initially, this seemed complex
, but after inspecting the Optimizely Forms framework, we discovered that the ProgressiveSubmitInfoService class could be leveraged to inject this behavior in a clean and maintainable way, as shown below.

using EPiServer.Forms.Core.Internal;
using EPiServer.Forms.Core.Models.Internal;
namespace alloy_example.Customization.Forms;

public class ExtendedProgressiveSubmitInfoService : ProgressiveSubmitInfoService
{
    public override ProgressiveSubmitInfo GetProgressiveSubmitInfo(Guid formContentGuid, HttpContext httpContext,
        string formLanguage)
    {
        //var isPathFound = httpContext.Request.Path.StartsWithSegments(RootPath); // e.g. can be checked based on httpContext 
        if (!string.IsNullOrEmpty(httpContext.Request.Form["TestElement"]))
        {
            return null;
        }
        return base.GetProgressiveSubmitInfo(formContentGuid, httpContext, formLanguage);
    }
}

Above code check if Element TestElement is found under httpContext after submission, this it will simply return null and forcing optimizely framework to generate new submissionId for given form submission.

As last step, make sure to register in DI container as below.

using EPiServer.Forms.Core.Internal;

services.AddSingleton<ProgressiveSubmitInfoService, ExtendedProgressiveSubmitInfoService>();

This overrides the default service and enables custom logic while keeping the framework's core behavior intact.

Hope, it helps someone!

Jul 21, 2025

Comments

Please login to comment.
Latest blogs
A day in the life of an Optimizely OMVP - Optimizely Opal: Specialized Agents, Workflows, and Tools Explained

The AI landscape in digital experience platforms has shifted dramatically. At Opticon 2025, Optimizely unveiled the next evolution of Optimizely Op...

Graham Carr | Dec 16, 2025

Optimizely CMS - Learning by Doing: EP09 - Create Hero, Breadcrumb's and Integrate SEO : Demo

  Episode 9  is Live!! The latest installment of my  Learning by Doing: Build Series  on  Optimizely Episode 9 CMS 12  is now available on YouTube!...

Ratish | Dec 15, 2025 |

Building simple Opal tools for product search and content creation

Optimizely Opal tools make it easy for AI agents to call your APIs – in this post we’ll build a small ASP.NET host that exposes two of them: one fo...

Pär Wissmark | Dec 13, 2025 |

CMS Audiences - check all usage

Sometimes you want to check if an Audience from your CMS (former Visitor Group) has been used by which page(and which version of that page) Then yo...

Tuan Anh Hoang | Dec 12, 2025

Data Imports in Optimizely: Part 2 - Query data efficiently

One of the more time consuming parts of an import is looking up data to update. Naively, it is possible to use the PageCriteriaQueryService to quer...

Matt FitzGerald-Chamberlain | Dec 11, 2025 |

Beginner's Guide for Optimizely Backend Developers

Developing with Optimizely (formerly Episerver) requires more than just technical know‑how. It’s about respecting the editor’s perspective, ensurin...

MilosR | Dec 10, 2025