Skip Navigation

[Résolu] Custom validation error message does not show

Ce fil est résolu. Voici une description du problème et la solution proposée.

Problem:
Custom Validation error message does not show in CRED form.

Solution:
In CRED form we have validation Messages section where you can modify text -- screenshot here:
https://d7j863fr5jhrr.cloudfront.net/wp-content/uploads/2017/10/584503-Validation_messages.png?x99441

OR to display it inline with each field, we can change front end messages in CRED form by using JS. Please add following code CRED form >> JS editor section of your form:

jQuery(document).ready(function() {
  
  jQuery('input[name="wpcf-custom-field"]')
    .data('wpt-validate', {
      required: {
        args: {
          1: true
        },
        message: 'Custom Notification goes here'
      },
    }
    );
});
This support ticket is created Il y a 7 années et 1 mois. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Aucun de nos assistants n'est disponible aujourd'hui sur le forum Jeu d'outils. Veuillez créer un ticket, et nous nous le traiterons dès notre prochaine connexion. Merci de votre compréhension.

Sun Mon Tue Wed Thu Fri Sat
- 12:00 – 17:00 12:00 – 17:00 12:00 – 17:00 12:00 – 17:00 12:00 – 17:00 -
- 18:00 – 21:00 18:00 – 21:00 18:00 – 21:00 18:00 – 21:00 18:00 – 21:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

Ce sujet contient 12 réponses, a 2 voix.

Dernière mise à jour par toolset-dave Il y a 7 années et 1 mois.

Assisté par: Noman.

Auteur
Publications
#583919

Hi,

I have created CRED user registration form and the custom Validation error message which I filled in Checkbox (for accepting the terms) in User Fields does not show. The form shows only the general Required field message.

#583938

Noman
Supporter

Les langues: Anglais (English )

Fuseau horaire: Asia/Karachi (GMT+05:00)

Hi Dave,

Thank you for contacting Toolset support. Where have you added that Custom validation error message, in which particular field or section?

1. Can you please provide backend screenshot for that error message field?
2. And please also provide link to the form page?

Thank you

#584018

Hi, can I send it as a private message?

#584105

Noman
Supporter

Les langues: Anglais (English )

Fuseau horaire: Asia/Karachi (GMT+05:00)

Yes sure, I have now enabled private message box.

Thanks

#584184

Noman
Supporter

Les langues: Anglais (English )

Fuseau horaire: Asia/Karachi (GMT+05:00)

Thanks for screenshot and link. On the given link form section is empty, is it only visible to loggedin users?

#584207

Please try again now. Thanks.

#584503

Noman
Supporter

Les langues: Anglais (English )

Fuseau horaire: Asia/Karachi (GMT+05:00)

Validation messages.png

Hello Dave,

That “Validation error message” field is for Backend only, that shows on Edit post page. That is not supposed to show up in CRED form. In CRED form we have validation Messages section where you can modify text -- please see attached screenshot.

OR to display it inline with each field, we can change front end messages in CRED form by using JS. Please add following code CRED form >> JS editor section of your form:

jQuery(document).ready(function() {
 
  jQuery('input[name="wpcf-souhlas-s-obchodnimi-podminkami"]')
    .data('wpt-validate', {
      required: {
        args: {
          1: true
        },
        message: 'Custom Notification goes here'
      },
    }
	);
});

==> Please make sure to replace Custom Field slug and Message in the above code as needed.

Thank you

#584616

I know that in CRED forms are some validation messages, but I needed another one, so thank you for the provided code. But I have a new problem, I tried to paste it to JS editor and if I save it, all the code disappear.

#584719

Noman
Supporter

Les langues: Anglais (English )

Fuseau horaire: Asia/Karachi (GMT+05:00)

You can use this plugin to add the JS code In Admin or WP backend:
https://wordpress.org/plugins/custom-css-js/

If problem still occurs, I would need to request for temporary WP and FTP login info for your staging site. Thank you

#584737

Can you please inspect it on my site? I cannot save even CSS code to CRED form. I will provide you login details.

#584741

Noman
Supporter

Les langues: Anglais (English )

Fuseau horaire: Asia/Karachi (GMT+05:00)

Okay, please provide temporary access (WP-Admin and FTP Login info) to your site (preferably staging site).

Your next answer will be private which means only you and I have access to it.

=== Please backup your database and website ===

✙ I would additionally need your permission to de-activate and re-activate Plugins and the Theme, and to change configurations on the site. This is also a reason the backup is really important.

✙ Please provide Cred Form Edit link.

Thank you

#584826

Noman
Supporter

Les langues: Anglais (English )

Fuseau horaire: Asia/Karachi (GMT+05:00)

custom validation message JS.png

Hello Dave,

I cannot save even CSS code to CRED form.
>> This issue is already reported for WordPress 4.8.3. And escalated to our development team, which should be fixed soon.

For now I have added the custom JS code here, you can update the validation message (see attached screenshot):
lien caché

Thank you

#584847

Thank you, Noman, for your support.