How to create a custom submit message, depending on conditions when creating an Umbraco form rather than general Submit Message / Go to page

I have created a custom workflow and I would like to create a custom submit message rather than the general Submit Message / Go to Page built in workflow. I would like to create specific submit messages depending on certain question outcomes in my umbraco form/workflow. Is there any way to achieve this?

You probably have to do something custom to achieve a conditional submit message. Perhaps one way to go about it is to have the submit take the user to a custom page with the logic you want processed there? You should be able to nab the form data and do any conditional logic yourself on the page.

1 Like

If using go to page…
Assuming your conditions are related to form values…

Extending | Forms | Umbraco Documentation

From an older version.. but as inspiration for the full implentation..
Getting Submitted Form Data in Umbraco Forms

If you want to use the submit message…
You could also manipulate via default theme overrides..
Themes | Forms | Umbraco Documentation

Sumbitted.cshtml

@model Umbraco.Forms.Web.Models.FormViewModel

@if (Model.MessageOnSubmitIsHtml)
{
    <div class="umbraco-forms-submitmessage-html">
        @Model.GetMessageOnSubmit()
    </div>
}
else
{
    <div>
        <span class="umbraco-forms-submitmessage">
            @Model.GetMessageOnSubmit()
        </span>
    </div>
}
@await Html.PartialAsync("Forms/Themes/default/ScrollToFormScript")

More involved.. you’ll see in the default theme RenderForm.cshtml

@using (Html.BeginUmbracoForm<Umbraco.Forms.Web.Controllers.UmbracoFormsController>("HandleForm", null, Model.HtmlAttributes, method: FormMethod.Post, antiforgery: Model.RenderAntiForgeryToken))
        {
...
}

you could add and use your own ā€œHandleFormā€ Method but not sure if you can inherit/override the native UmbracoFormsController…

1 Like

Umbraco CMS 13.13.0
Umbraco Forms 13.9.4

Thanks for your advice. I’ve created a custom page and created submit messages depending on the form logic. This works great, but I wouldn’t need to use a custom page if I could override the custom submit message in my custom workflow. When ever I try to override it, the ā€˜Go to page / submit message’ default message keeps appearing. Is this a known bug or am I should I be able to override this?

Did you try adding a Submitted.cshtml in the default theme folder to override?

/Views/Partials/Forms/Themes/default (it won’t exist as uForms delivered by a razor class library, but you can override)

then you can discard the @Model.GetMessageOnSubmit() and add what ever logic you want?

As you can’t override the form.messageOnSubmit in a workflow AFAIK..