Title: Unique ID Error
Last modified: August 30, 2016

---

# Unique ID Error

 *  Resolved [MasterRed](https://wordpress.org/support/users/masterred/)
 * (@masterred)
 * [11 years ago](https://wordpress.org/support/topic/unique-id-error/)
 * I’m trying to use:
    `$ninja_forms_processing->get_error(‘unique_id’)` to get 
   the error message for “invalid email” and “wrong answer to spam question”
 * Which are their “unique ID” ?
 * My function 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('unique ID for INVALID EMAIL' => array('error_msg' => 'MY MESSAGE', 'display_location' => 'MY LOCATION'));
        }
       ```
   
 * Tks
 * [https://wordpress.org/plugins/ninja-forms/](https://wordpress.org/plugins/ninja-forms/)

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Thread Starter [MasterRed](https://wordpress.org/support/users/masterred/)
 * (@masterred)
 * [11 years ago](https://wordpress.org/support/topic/unique-id-error/#post-6248071)
 * 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?
 *  Thread Starter [MasterRed](https://wordpress.org/support/users/masterred/)
 * (@masterred)
 * [11 years ago](https://wordpress.org/support/topic/unique-id-error/#post-6248147)
 * I have solved with another type of function
 *  Thread Starter [MasterRed](https://wordpress.org/support/users/masterred/)
 * (@masterred)
 * [11 years ago](https://wordpress.org/support/topic/unique-id-error/#post-6248148)
 * 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

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Unique ID Error’ is closed to new replies.

 * ![](https://ps.w.org/ninja-forms/assets/icon-256x256.png?rev=1649747)
 * [Ninja Forms - The Contact Form Builder That Grows With You](https://wordpress.org/plugins/ninja-forms/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ninja-forms/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ninja-forms/)
 * [Active Topics](https://wordpress.org/support/plugin/ninja-forms/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ninja-forms/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ninja-forms/reviews/)

 * 3 replies
 * 1 participant
 * Last reply from: [MasterRed](https://wordpress.org/support/users/masterred/)
 * Last activity: [11 years ago](https://wordpress.org/support/topic/unique-id-error/#post-6248148)
 * Status: resolved