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)
Viewing 1 replies (of 1 total)
- The topic ‘Ninja Forms Custom Validation’ is closed to new replies.