Check all options in Lookup field (Repeater)

By: George Ciamita | Asked: 02/15/2023
ForumsCategory: Code HelpCheck all options in Lookup field (Repeater)
George Ciamita asked 1 year ago
Hello there, I am not sure if some of you have met this challenge before, I want to automatically check all the boxes in a lookup field that is watching another Lookup field. Formidable has a javascript for this that works more than great outside of the repeater field, the issue is that both of my fields are in a repeater section and the javascript seems to not work. Will be possible to have this result working in a repeater? Here is the javascript <script type="text/javascript">
jQuery(document).ready(function () {
var checkBoxDiv = jQuery( document.getElementById( 'frm_field_1437_container' ) );
checkBoxDiv.on( 'frmLookupOptionsLoaded', function() {
var checkboxes = document.getElementsByName('item_meta[1437][]');
for ( var i = 0, n = checkboxes.length; i < n; i++){
checkboxes[i].checked = true;
}
});
});
</script> Any help is more than welcome :hug:   
1 Answers
Victor Font answered 1 year ago
The problem you are experiencing has to do with Ajax and jQuery operations. I suggest you take a look at this article, it may help: https://formidable-masterminds.com/repeaters-and-complex-jquery-operations/

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right