• Resolved juliarrr

    (@juliarrr)


    Hi,

    the problem can be replicated on the current WordPress version on the default theme like 2021.

    When adding several forms on one page (two and more) select2.js script works only for the last one.

    Please let me know when it will be fixed. Thank you!

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Support Kris – WPMU DEV Support

    (@wpmudevsupport13)

    Hi @juliarrr

    I hope you are doing good today.

    This is a known issue in Forminator and our developers already working on a fix and this should be fixed in the next update. As for now, there is a temp fix that you can implement on your site as a mu-plugin.

    add_filter( 'forminator_field_single_markup', function( $html, $element_id ){
    	static $select_id;
    	if( false !== strpos( $element_id, 'select-') && preg_match( '/select-([\d]+)-field/', $element_id, $matches ) ){
    		if( $select_id ){
    			$select_id += 1;
    			$html = str_replace( $element_id, "select-$select_id-field", $html );
    		}else{
    			$select_id = intval( $matches[1] );
    		}
    		$select_id ++;
    	}
    	return $html;
    }, 10, 2 );

    Please save the above code as “select-field-fix.php” and upload it to /wp-content/mu-plugins/ folder. Later on, refresh page and issue should be gone.

    We apologize for the inconvenience

    Kind Regards,
    Kris

    Thread Starter juliarrr

    (@juliarrr)

    Hi Kris, thanks a lot for your reply!

    The matter is that this fix doesn’t work for Timepicker and Address fields, it works only for the Selectors.
    Could you please provide the solution for all fields?
    Thanks in advance!

    Hi @juliarrr,

    I have forwarded this to our devs to see if there’s a workaround that could be applied for other fields until the issue is fixed within the plugin directly.

    We will update you here once we have further info.

    Cheers,
    Predrag

    Plugin Support Nithin – WPMU DEV Support

    (@wpmudevsupport11)

    Hi @juliarrr,

    Please try this new snippet instead of the previous code shared and see whether it works on your side.

    https://gist.github.com/wpmudev-sls/5f3704bcab9cb24c8f18ea0170fb36c9

    The above code can be added as a mu-plugins. Please check this link on how to implement the above code as a mu-plugins:
    https://premium.wpmudev.org/docs/using-wordpress/installing-wordpress-plugins/#installing-mu-plugins

    Please do let us know if you need any further assistance. Have a nice day ahead.

    Best Regards,
    Nithin

    Plugin Support Patrick – WPMU DEV Support

    (@wpmudevsupport12)

    Hi @juliarrr

    I hope you are doing well and safe!

    We haven’t heard from you in a while, I’ll mark this thread as resolved.

    Feel free to let us know if you have any additional questions or problems.

    Best Regards
    Patrick Freitas

    Thread Starter juliarrr

    (@juliarrr)

    Thank you, this solution works for us!
    Have a nice day!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Problem with select2.js script’ is closed to new replies.