formio

Formio:- Custom Error Message when the submit button is pressed without filling the required fields


I would like to change the error message that is displayed in situations where we click the submit button, but some compulsory fields are empty. The message that I receive by default is "Please check the form and correct all errors before submitting the form". I want to use instead a custom message. Is there a way to achieve this ?


Solution

  • You can override the error message by adding to the options when creating a form:

    var options = {
       i18n: {
                en: {
                      submitError: 'My custom submission error',
                }
       }
    }
    

    And then later you're probably doing a call to Formio.createForm(Formio.createForm(document.getElementById(settings.id), formDefinitionUrl, options) which is where the options object you need is found.

    Here's a list of the strings you can override this way: https://github.com/formio/formio.js/blob/master/src/translations/en.js