Custom Error Messages

Custom Error Messages

In field validations, user-defined error messages always appear in pairs, each separated as error messages for PHP and JavaScript.

Configuration

The settings for the two error messages can be found in the field configuration at the following location:

  • Field Configuration » Tab: Basic Settings

    Group: Help Text and Error Messages » Parameter: Custom Error Message (JavaScript) = ‘Message directly next to the field’.
    Group: Help Text and Error Messages » Parameter: Custom Error Message (PHP) = ‘Message at the top of the returned form’.

User-defined error messages

Inline Help

The configuration contains explanations if inline help is enabled.
The inline help in the configuration can be toggled by clicking the Toggle Inline Help button.
Here are brief quotes from the inline help for both options.

Custom Error Message (PHP)

This text is displayed if the user enters invalid input and the server-side (PHP) validation detects this.
If you leave this field blank, the standard Visforms error message will be used.

Custom Error Message (JavaScript)

This text is displayed if the user enters invalid input and the browser-side (JavaScript) validation detects this. If you leave this field blank, the standard Visforms error message will be used.

Explanation

There are always two error notifications per calculation or field value validation.

  • The error notification in the web browser (JavaScript message):
    • Appears before the form is submitted directly next to the form field.
  • The error notifications from the PHP backend (PHP message):
    • Only appear after the form has been submitted and redisplayed.
    • They then appear together at the very top of the form and no longer directly next to the form fields.

For the following reasons for the different display locations and times:

  • Visforms has two different standard error messages for PHP and JavaScript for each calculation or validation.
  • There are two separate user-defined error messages for PHP and JavaScript for each calculation or validation in the configuration.

Security reasons

For security reasons, the results of calculations and validations are not simply transferred when the form is submitted.
All calculations and validations are calculated independently of each other in the web browser (JavaScript) and in the backend (PHP).

Calculations and validations are present in the original in the backend

Calculations and validations are present in the original in the backend without ever having been in the web browser form and therefore enjoy a high level of trust. This prevents, for example, the malicious simple transmission of a fake or falsified result of a calculation or validation. All other malicious manipulation of calculations and validation in the web browser is also prevented.