Home Forums Add-ons Repeater Field Use a radio button across a Repeater Reply To: Use a radio button across a Repeater

  • 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:

    	$(document).ready(function() {
    		// cache the checkboxes
    			$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 && !$'checked').length) {
    			//  ... check the first