BigBlockChevy

Hide/Disable rules dont apply when setting check box values with JavaScript

Jump to solution

So ive been trying to get this to work with no sucess

i have a multiple choice field that unhides radio button controls based on different options selected

one of the hidden radio buttons has a selection that sholud select all options in the previous multi select choice control as well as select 'Remove' option in the hidden controls.

 

Once all options are selected in the multichoice field rules dont apply and other choice controls stay hidden, and the ProcessOnChange(ControlD) doesnt work. if i uncheck any of the options in the multiselect choice controls code runs as expected

 

below is my code (the top code above the function clears radio buttons when controls are hidden):

 

NWF.FormFiller.Events.RegisterBeforeReady(preReady);
NWF.FormFiller.Events.RegisterAfterReady(onReady);

function preReady() {
   NWF$("table.nf-form-footer").hide();
   NWF$("#Hero-WPQ3").hi
 
function onReady() {
var CorpReq = NWF$("#" + CorpReqVar);
var EmailReq = NWF$("#" + EmailReqVar);
var WebMail = NWF$("#" + WebMailVar);
var WebEx = NWF$("#" + WebExVar);
var Inter = NWF$("#" + InterVar);
var Fax = NWF$("#" + FaxVar);
NWF$(document).change(function(){
if (CorpReq.is(":visible") == false){
CorpReq.find("input:checked").attr("checked",false);
}
if (EmailReq.is(":visible") == false){
EmailReq.find("input:checked").attr("checked",false);
}
if (WebMail.is(":visible") == false){
WebMail.find("input:checked").attr("checked",false);
}
if (WebEx.is(":visible") == false){
WebEx.find("input:checked").attr("checked",false);
}
if (Inter.is(":visible") == false){
Inter.find("input:checked").attr("checked",false);
}
if (Fax.is(":visible") == false){
Fax.find("input:checked").attr("checked",false);
}
});function SetDeleteOptions(){
  if(NWF$("#"+CorpReqVar).find('input:checked').val()=="Delete"){
    NWF$("#"+ReqServVar).find('input[value="Email"]').prop("checked",true);
    NWF$("#"+ReqServVar).find('input[value="Internet"]').prop("checked",true);
    NWF$("#"+ReqServVar).find('input[value="Web Mail"]').prop("checked",true);
    NWF$("#"+ReqServVar).find('input[value="WebEx"]').prop("checked",true);
    NWF$("#"+ReqServVar).find('input[value="Fax"]').prop("checked",true);
    NWF$("#" + EmailReqVar).find('input:radio[value="Remove"]').click();
    NWF$("#" + WebMailVar).find('input:radio[value="Remove"]').click();
    NWF$("#" + WebExVar).find('input:radio[value="Remove"]').click();
    NWF$("#" + InterVar).find('input:radio[value="Remove"]').click();
    NWF$("#" + FaxVar).find('input:radio[value="Remove"]').click();
    NWF.FormFiller.Functions.ProcessOnChange(CorpReqVar);
  } else{
    NWF$("#"+ReqServVar).find('input[value="Email"]').prop("checked",false);
    NWF$("#"+ReqServVar).find('input[value="Internet"]').prop("checked",false);
    NWF$("#"+ReqServVar).find('input[value="Web Mail"]').prop("checked",false);
    NWF$("#"+ReqServVar).find('input[value="WebEx"]').prop("checked",false);
    NWF$("#"+ReqServVar).find('input[value="Fax"]').prop("checked",false);
    NWF.FormFiller.Functions.ProcessOnChange(CorpReqVar);
  }
}
NWF$("#"+CorpReqVar).click(SetDeleteOptions);
}
0 Kudos
Reply
1 Reply
BigBlockChevy

Re: Hide/Disable rules dont apply when setting check box values with JavaScript

Jump to solution

Issue is fixed by adding "Events" as below

NWF.FormFiller.Functions.ProcessOnChangeEvents(CorpReqVar);

View solution in original post

0 Kudos
Reply