Change MessageOnSubmit in Umbraco Forms

548 Views Asked by At

I am building some forms with Umbraco Forms, but before I do I need to ensure that it is going to be able to be extended in the way I need. Can anybody tell me how I can alter the MessageOnSubmit property to show a custom success message for each submission?

I have tried setting this (e.Form.MessageOnSubmit) in a custom workflow type, but the original message set in the UI is still always shown.

Appreciate any guidance you can offer.

Gary

2

There are 2 best solutions below

0
Robert Foster On

It is possible to override the default UmbracoFormsController for form submission by inheriting from it yourself; and then overriding the OnFormHandled - from there you can set the MessageOnSubmit property on the model.

Then it's just a matter of updating the Razor template responsible for generating the form to point at your new controller instead of the default.

0
Tim On

Another option would be to point the thank you at a page, that will pass the ID of the submission on the query string. You could then use that to generate any custom message that you need, in the view for the thank you page.