Title: Ninja Forms Custom Validation
Last modified: October 5, 2018

---

# Ninja Forms Custom Validation

 *  Resolved [nadyusha](https://wordpress.org/support/users/nadyusha/)
 * (@nadyusha)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/ninja-forms-custom-validation/)
 * I have a problem creating custom validation for my Ninja Forms. I am using something
   like this:
 *     ```
       add_filter('ninja_forms_submit_data', 'custom_ninja_forms_submit_data');
       function custom_ninja_forms_submit_data($form_data)
       {
       $field_id = 2;
       $field_value = $form_data['fields'][$field_id]['value'];
   
       $exists = true; // Check your database if $field_value exists
   
       if($exists)
       {
           $form_data['errors']['fields'][$field_id] = 'Value already exists';
       }
   
       return $form_data;
       }
       ```
   
 * the problem is – my validation isn’t related to fields. I check some of the entered
   data and in case of an error – I need to show just general error message without
   blocking submit button. This code above shows error message below the field 2
   and user can’t submit the form again without editing this field.

Viewing 1 replies (of 1 total)

 *  Plugin Support [Curtis](https://wordpress.org/support/users/curtisbrownlee/)
 * (@curtisbrownlee)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/ninja-forms-custom-validation/#post-10789280)
 * Hello,
 * Thank you for contacting us. I hope that you are doing well.
 * For custom code, there is developer documentation which is provided as-is and
   also a Developer Slack channel where coders can give advice on how to achieve
   custom code goals:
    Codex: [http://developer.ninjaforms.com/codex/](http://developer.ninjaforms.com/codex/)
   Slack channel: [http://developer.ninjaforms.com/slack](http://developer.ninjaforms.com/slack)
 * The developers of Ninja Forms also frequent the Development Slack channel.
 * Because we only check these forums once per week, we strongly encourage you to
   reach out to us here with any followup questions in order to get a timely response:
   [https://ninjaforms.com/contact/](https://ninjaforms.com/contact/) There, we 
   offer support free support directly to our Ninja Forms users with significantly
   more privacy and a faster response time.
 * Best regards,
 * Curtis
    WP Ninja

Viewing 1 replies (of 1 total)

The topic ‘Ninja Forms Custom Validation’ 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/)

 * 1 reply
 * 2 participants
 * Last reply from: [Curtis](https://wordpress.org/support/users/curtisbrownlee/)
 * Last activity: [7 years, 8 months ago](https://wordpress.org/support/topic/ninja-forms-custom-validation/#post-10789280)
 * Status: resolved