I have several Checkboxes for Conditional Groups in my Cred Post Form like this:
[cred_field field='angaben-zu-starken' force_type='field' class='form-check-input' output='bootstrap']
[cred_show_group if="( $(angaben-zu-starken) eq 'ja' )" mode="fade-slide"]
a lot of important fields ....
[/cred_show_group]
I needed to setup a bootstrap modal confirm for unchecking the checkboxes. The modal window has an option to "cancel unchecking". Everything works so far but the conditional Group does not show up, when the checkbox is set with Javascript, depending of the Button-Click in the modal window.
I tried with ".trigger('change')" and ".change()" ... the conditional group does not show up but the checkbox is checked.
jQuery("input[name='wpcf-angaben-zu-starken']").prop('checked', true).trigger('change');
Of course I could set the groups visible but all forms are getting disabled and would't save (this was the main Reason for me to work on this modal, i didn't want the users to think this is a collapse function).
Is there a way to to hook in the conditional group controle? I really was thinking that i had the hard part of work done ...
Hi,
Thank you for contacting us and I'd be happy to assist.
On my test website, I was able to make the checkbox linked to a conditional group trigger, using a custom script, like this:
jQuery( document ).ready(function() {
jQuery( "a.link" ).click(function(event){
event.preventDefault();
jQuery( "input[name=wpcf-book-checkbox]" ).trigger('click');
});
});
I included a custom link with class "link" and when it was clicked, it would also check the checkbox for the "book-checkbox" field, which in turn would show the linked conditional group too.
I hope this helps and please let me know if you need any further assistance around this.
regards,
Waqar
Hi Waqar,
thank you for your quick reply. My Issue is resolved, you made my day.
Kinde regards
Fatih
My issue is resolved now. Thank you!