• Resolved Claudio

    (@cl4udio)


    Hi team,

    I have the following situation with a form but I can’t find a solution with its current conditions at Forminator:

    The form has pagination mode turned on. Each checkbox is on its own page break:

    – checkbox-2 | Options: 1, 2, 3, 4
    – checkbox-3 | Options: 1, 2, 3, 4
    – checkbox-8 | Options: A, B, C, D

    I need auto-select any or specific options from checkbox-2 and checkbox-3 to checkbox-8.

    – If is selected 3 at checkbox-2 it’s neccesary auto-select the “C” at checkbox-8.
    – If is selected 3 at checkbox-3 it’s neccesary auto-select the “C” at checkbox-8.
    – If is present 3 in both (checkbox-2, checkbox-3) auto-select the “C” at checkbox-8.

    If isn’t possible, works for me only achieve to auto-select from one checkbox option to another automatically.

    Thanks in advance.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Nebu John – WPMU DEV Support

    (@wpmudevsupport14)

    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

    Thread Starter Claudio

    (@cl4udio)

    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.

    Plugin Support Laura – WPMU DEV Support

    (@wpmudevsupport3)

    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

    Thread Starter Claudio

    (@cl4udio)

    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,

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Enable auto selecting options from another checkbox’ is closed to new replies.