lundi 2 mars 2015

How to use the built in tooltip for form validation error messages in WP admin plugin?


I'm building a wordpress plugin that includes serveral menus in the wordpress backend (admin). I'd like to use as many existing parts as possible and make my menus look like the standard wordpress ones.


Wordpress already does quite nice form validation on its admin forms and I already reuse the form-required class to enforce required form fields. However, I also need some validations that require an error message. I found a very nice tooltip-style version when you try to enter letters for media size: tooltip-style form validation error message in wordpress admin (media settings)


Can somebody provide a hint on how to reuse this from a custom jquery form validation script?


My form validation script does an ajax-request to find out if an email address is already taken. So using the number validation won't be enough, I need to put a custom error message inside the tooltip.





Aucun commentaire:

Enregistrer un commentaire