jeudi 5 mars 2020

Marketo Form Checkbox - uncheck checkbox when another is checked

I am working with Marketo form, try all the possible ways I can think of to trigger: "uncheck checkbox when another is checked".

Just some background, "globalGenericString2" will be checked after the form load.

I also tried, "globalGenericString1" click > "globalGenericString2" uncheck, and do the same on "globalGenericString2" click > "globalGenericString1" uncheck. When I do that is created a bug, which you will need to click on the checkbox two times to have the checkmark.

Help PLZ!!!!

MktoForms2.whenReady(function (form2) {
if ($("input[name='globalGenericString2']").is(":checked") == false){
      $("input[name='globalGenericString2']").trigger('click');
      $("input[name='globalGenericString2']").is(":checked");
      $("input[name='globalGenericString2']").prop("checked", true);
      }

// seem working, but not stable and not working on Firefox
$("input[type='checkbox']").click(function(){
$("input[type='checkbox']").trigger('click');
});
});
<div class="mktoFormRow" style="">
<label for="globalGenericString2" class="mktoLabel mktoHasWidth">
<input name="globalGenericString2" id="ID" type="checkbox" value="physical" class="mktoField" style="">
<label for="ID">Both hard copy and digital (PDF)</label>
</div>

<div class="mktoFormRow" style="">
<label for="globalGenericString1" class="mktoLabel mktoHasWidth">
<input name="globalGenericString1" id="ID" type="checkbox" value="physical" class="mktoField" style="">
<label for="ID">Only digital (PDF)</label>
</div>



Aucun commentaire:

Enregistrer un commentaire