you are very welcome!
I was in a hurry earlier, I just edited my English and cleaned up the JS (well, the jQuery) a bit.
thank you for your help John.
since there is no “out-of-the-box” method, I enacted plan B.
replaced radio buttons with checkboxes and added some JS.
here it is, in case somebody else would ever need it:
(function($){
$(document).ready(function() {
// cache the checkboxes
var
$acftable = $('table.acf-table'),
$checkboxes = $acftable.find('ul.acf-checkbox-list input');
// delegation will make sure click on newly added elements will trigger the function
$acftable.on('click', 'ul.acf-checkbox-list input', function(){
// uncheck all
$checkboxes.prop('checked', false);
// check the clicked one
$(this).prop('checked', true);
});
// if checkboxes exists on the page, but none is checked ... then
if ($checkboxes.length && !$checkboxes.is('checked').length) {
// ... check the first
$checkboxes.eq(0).click();
}
});
})(jQuery);
no, sorry, I wasn’t clear in my explanation.
I have an Options Page dedicate to a specific website page (i.e. Contact Us)
in it I have a repeater, and in each row, I store a some text (textarea), and a label (text field)
I do have posts that when in a specific category, do have a timepicker and a select box that is populated with the labels (text field) in each row of the Options Page … this way I can choose which text I want to use in the Contact Us page for a specific time span (i.e. during sales).
in the Options Page’s repeater I also included a radio button.
I would like for it to work across the Repeater’s rows so that I can pick the default text to be selected when populating the Select box for the first time or to be used in the Contact Us page when no posts in that category are present.
I hope I made sense…
John, thank you so much!
$tag_id was = $term_id
my bad for being unfamiliar with the proper terms.
I did prefix it with the $taxonomy_slug like you explained and now it works perfectly.
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.