This article contains PHP code and is intended for developers. We offer this code as a courtesy, but don't provide support for code customizations or 3rd party development.
This hook allows the modification of the message shown at the top of a form when there is an invalid field entry. The default invalid field message says "There was a problem with your submission. Errors are marked below."
Usage
add_filter('frm_invalid_error_message', 'change_frm_form_error_message', 10, 2);
Parameters
- $invalid_msg (string)
- $args (array):
- 'form' (object)
Examples
Change the invalid field message for a single form
Use the code below to change the invalid field error message for a single form. Replace 123 with the ID of your form. Replace 'My custom error message' with your custom error message.
add_filter('frm_invalid_error_message', 'change_frm_form_error_message', 10, 2);
function change_frm_form_error_message( $invalid_msg, $args ) {
if ( $args['form']->id == 123 ) {
$invalid_msg = 'My custom error message';
}
return $invalid_msg;
}