Home › Forums › Front-end Issues › Custom Validation › Reply To: Custom Validation
Hi, Can you post an example of the full code. I’m really struggling..
$field = jQuery(
What should I write here - Field type, name, id ? with quotes or without ?
);
And should I change the field here or location of acf/validate_field:
jQuery(document).on('acf/validate_field', function( e, field ){
I want to get a simple dummy false validation to check if it is working:
jQuery(document).on('acf/validate_field', function( e, field ){
$field = jQuery(field);
$field.data('validation', false);
});
Notes:
I have hooked the .js file like this:
add_action( 'wp_enqueue_scripts', 'my_enqueue_styles_scripts' );
function my_enqueue_styles_scripts() {
wp_enqueue_script( 'acf-custom-validation', get_template_directory_uri() .'/js/acf-validation.js', array( 'acf-input' ) );
}
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.