Prasanna Venkatesh
Prasanna Venkatesh

Reputation: 402

Displaying custom error messages in wp ninja forms

How can I show custom error messages in wordpress ninja forms plugin. I have searched for ninja forms docs but unable to reach the site. By default the error message is showing as

This is a Required field.

I want it to be

Please enter respective field name.


Ninja forms form builder have the following options for validation. See the below image Is there a way to display this error message with respective field name?.

Thanks in advance.

Upvotes: 3

Views: 7447

Answers (2)

Louis S
Louis S

Reputation: 21

I have a rough jQuery solution that checks for any form changes/events and replaces the default error message for a specific input field.

$(document).on( 'nfFormReady', function( e, layoutView ) {

$('form').on('focus focusout keyup submit', 'input', function() {

    $('#nf-error-7 .nf-error-required-error').text('New Required Error Message');

});

});

I'm sure it can be adapted for multiple input types/fields.

Upvotes: 2

Muhammad Akber Khan
Muhammad Akber Khan

Reputation: 757

try this link, there are some hooks to get custom settings,

http://developer.ninjaforms.com/codex/submission-processing-hooks/

on this link there is a filter,

FILTER: ninja_forms_pre_validate_field_settings

will be helpfull for you, you have to print_r($field_settings) and use your field conditions to get correct custom error message, sorry for my bad english, open to answer any question

Upvotes: 5

Related Questions