Hi @partaim
I hope you are doing well today.
Can you export your form, upload it to Google Drive, and share a link in your next reply so that we can be on the same page? Also, attach in Google Drive screenshots about which fields we are talking about as the site URL you have shared seems to be in the Italian language and password protected.
Kind Regards,
Kris
Hi partaim
Thank you for the additional data. I pinged our SLS Team so that they can dig into this issue further for you. We will post an update here as soon as more information is available.
Kind Regards,
Kris
Hi Kris,
thank you, i’ll wait for you! 🙂
Hi,
do you have any news about the problem? Thank you in advance! 🙂
Hi @partaim
I apologize for long response. We’ve missed relevant e-mail notification on our end, I’m really sorry about that.
Please make following change in the code that you tried (this one):
replace this (it’s part of line 66)
_selected >= _forminator_restrict_multiple_fields.limit[ _parent_id ]
with this
_selected < _forminator_restrict_multiple_fields.limit[ _parent_id ]
Best regards,
Adam
Hi Adam,
don’t worry, it happens sometimes! 🙂
By the way, i tried the code above, but i’m still able, in checkbox-11, to proceed to the next checkbox (checkbox-12) even if i checked less than 8 options. Meanwhile, the previous 10 checkboxes, for which I set a limit of 1 check and which previously worked correctly, now allow me to select more options. I’m losing sleep over it! :’)
Hi @partaim
Thank you for understanding!
I’m sorry that this change didn’t help. I got it directly from our developers but maybe they missed something. I have asked them to double-check it again and I’m awaiting their response.
I’d appreciate a bit more patience (again, sorry for keeping you waiting!) and we’ll update you here again soon.
Best regards,
Adam
Hi @partaim,
Hope this message finds you well and sorry for our delay.
Our devs shared this new code:
add_action( 'wp_footer', 'wpmudev_limit_validation_checkbox', 9999 );
function wpmudev_limit_validation_checkbox() {
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(event, form_id) {
$.validator.addMethod("min_selection", function (value, element) {
let parent = $(element).closest('.wpmudev-checkbox-limit');
let selected = parent.find(':checkbox:checked').length;
if ( selected == 8 ) { // Exact selection limit here.
return true;
}
return false;
},"Please select 8 options.");
$( ".wpmudev-checkbox-limit input" ).attr( "min_selection", "min_selection" );
});
});
</script>
<?php
}
You might also need to add this class wpmudev-checkbox-limit in the styling tab of the checkbox field where you want exactly 8 selections.
Let us know the results.
Best regards,
Laura
It worksss!!!
You are awesome guys, thank you SO MUCH!!!! You just made my day 🙂
Hi @partaim,
Glad to hear it works, I am marking this as solved.
If you have any additional questions or require further help, please let us know!
Best regards,
Laura