Customize Invalid Email Error Message [RESOLVED]

Is there a way to customize/edit the default validation error message for the email field when an invalid address is entered?


You can customize the validation error in the field settings, example: Screenshot IMEVUpqvQq.png - Droplr

Result: Screenshot A3agtEkp5Z.png - Droplr


Thanks for your reply, and I am aware of the ability to override the default validation message with a custom text as pictured below, however, this overrides the validation message displayed for both an empty field and an invalid email address format.


(Gonna have to do this in multiple replies)

If the field is empty, I would like to keep the default validation message as pictured below.


I’d really like to customize the validation message specific to an invalid email address format, namely I’d like to change this from (e.g. to our example organization email address.


Then you will need to use the gform_field_validation filter and some custom PHP code. Example:

add_filter( 'gform_field_validation', function ( $result, $value, $form, $field ) {
	if ( ! $result['is_valid'] && $field->get_input_type() === 'email' && 'The email address entered is invalid, please check the formatting (e.g.' == $result['message'] ){
		$result['message']  = 'Custom validation message here.';
	return $result;
}, 10, 4 );

Precisely what I needed, thank you for your assistance Samuel!

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.