OK, found it but the code doesn’t work.
I need to be replaced, this code (in includes/fields/textbox.php row 306):
$ninja_forms_processing->add_error('email-general', $invalid_email);
with:
$ninja_forms_processing->add_error('email-general', $invalid_email, $field_id);
and this code (in includes/fields/spam.php row 131):
$ninja_forms_processing->add_error('spam-general', $spam_error, 'general');
with:
$ninja_forms_processing->add_error('spam-general', $spam_error, $field_id );
My code is:
function ninja_forms_newdisplay_error(){
add_action( 'ninja_forms_pre_process', 'ninja_forms_newdis', 100 );
}
add_action( 'init', 'ninja_forms_newdisplay_error' );
function ninja_forms_newdis(){
global $ninja_forms_processing;
$xxx = $ninja_forms_processing->get_all_errors();
$xxx = array(
'email-general' => array(‘error_msg’ => ‘MY MESSAGE’),
'spam-general' => array (‘error_msg’ => ‘MY MESSAGE’)
);
}
Can you help me?
I have solved with another type of function
Why edit post function disappears in short time?
Forced to write new post 🙁
My goal was to show just a mistake at a time in the alert box above the form.
This is my contribute:
function register_maxdisplay_errori(){
add_action( 'ninja_forms_pre_process', 'maxdisplay_errori', 100 );
}
add_action( 'init', 'register_maxdisplay_errori' );
function maxdisplay_errori(){
global $ninja_forms_processing;
$all_errors = $ninja_forms_processing->get_all_errors();
$numero_errori = count($all_errors);
if( $numero_errori > 4 ) {
$ninja_forms_processing->remove_error('spam-general');
$ninja_forms_processing->remove_error('email-general');
}
elseif ( $numero_errori > 2 ) {
$ninja_forms_processing->remove_error('spam-general');
}
}
I hope to be helpful to someone else.
Maybe next time I will have a little help for gratitude.
Bye