Hi @cl4udio,
I hope you keeping well today.
Unfortunately, Forminator does not have an out-of-the-box solution for this and I am sorry to inform you that the requirement looks a bit complex making it fall beyond the scope of our support.
I would recommend that you consider hiring a developer to create a custom solution for this requirement.
Kind Regards,
Nebu John
Thanks for your reply @wpmudevsupport14
And if not possible know how to auto select an option from one checkbox to another on same form?
Doing this I think can solve my issue in general.
Hi @cl4udio,
Hope this message finds you well and thanks for reaching us.
We checked with our Devs team about a workaround, and they provided this mu-plugin, you can follow this guide to install it.
add_action('wp_footer', 'wpmudev_form_checkbox_auto_selection', 9999);
function wpmudev_form_checkbox_auto_selection() {
global $post;
if ( is_a( $post, 'WP_Post' ) && !has_shortcode($post->post_content, 'forminator_form') ) {
return;
}
?>
<script type="text/javascript">
jQuery(document).ready(function($){
setTimeout(function() {
$('.forminator-custom-form').trigger('after.load.forminator');
},100);
$(document).on('after.load.forminator', function(e, form_id) {
if ( e.target.id == 'forminator-module-6' ) { //Please change the form ID
$( document ).on( 'forminator.front.pagination.move', function( e ) {
var selected = [];
$('.select-check input:checked').each(function() {
selected.push($(this).attr('value'));
});
if ( jQuery.inArray("3", selected) != -1 ) {
$('#checkbox-8 input[value="C"]').attr('checked','checked');
} else {
$('#checkbox-8 input[value="C"]').attr('checked', false);
}
});
}
});
});
</script>
<?php
}
Note that you need to replace this line:
if ( e.target.id == 'forminator-module-6' ) { //Please change the form ID
The number 6 with your own Forminator form ID.
Let us know the results.
Best regards,
Laura
Hi @wpmudevsupport3
Thank you very much for this!
I’ve solved the issue using your code.
Just to improve the solution, it’s neccesary update your code with the correct selector (depending of the used selector).
For reading the options selected from a checkbox: ‘.forminator-checkbox input:checked’
For reading the options selected from a radio box: ‘.forminator-radio input:checked’
Replacing at here on in this line:
$('.select-check input:checked').each(function() {
After doing this works like a charm.
Greetings,