acf_form_head() is in the wrong place.
The documentation of acf_form_head tels you:” This function must be placed before any HTML has been output, preferably above the get_header() function of your theme file.”
In input.js the function acf.validateForm(args)
is defined.
This function can be used to trigger the validation of a frontend form.
You can set args the following way:
const args = {
form: $form //required. The form you are submitting
//the following default values ar set in validate:function(args) :
// trigger event
event: false,
// reset the form after submit
reset: false,
// loading callback
loading: function(){},
// complete callback
complete: function(){},
// failure callback
failure: function(){},
// success callback
success: function( $form ){
$form.submit();
}
}
The default success callback starts submission when validation is is successful.
You can replace this function by any other function.
So you can block the validation and submission and call acf.validateForm:
$('.cursus-info').on('click','.acf-button',function() {
$('form#acf-form').on('submit',function(event){
event.preventDefault();
});
args= {
form: $form,
reset: true
success: function($form) {
//Your ajax code or what ever you want to do
}
}
acf.validateForm(args);
}
In addition to submitting by ajax using acf.validateForm
offers many other possibilities like validating without submisssion, do things when validation fails by defining the failure callback etc.
Same problem. I use checkboxes. When I check some terms for one post in the backend, only the checked terms are shown in the frontend, for all posts.
I am using acf 4.4.11.
I didn’t try the suggested solution yet. I prefer a solution where I don’t need to change the plugin files.
In the mean time I found an other solution. This is no longer an issue for me.
Thanks
Rob Ruifrok
Elliot,
Thank you.
I can live with 4.4.0 for now, awaiting the next version.
Rob
I’m running the website fysiocursus.nl. This is directory of courses for physiotherapists. Once every month I upload a set of new courses as a concept using Really Simple CSV Importer. The custom post type and custom taxonomies are created using Types. Up to ACF 4.4.0 the uploaded taxonomy terms were reflected in the custom taxonomy field.
In 4.4.2 the oploaded terms are not reflected in the cutom field. When I tick one ore more terms in the custom field, these are saved on publication or updating the post.
John,
Yes , I use WP4.2.2.
No, I don’t use the same terms in different taxonomies.
I just tested it again on a local install: same problem
ACF 4.4.0 works OK, ACF 4.4.2 does not load the taxonomy terms in the custom field.
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.