CASC :multi on change?

Forums Cascading dropdowns CASC :multi on change?

This topic contains 6 replies, has 2 voices, and was last updated by  Alexander Bautz 4 months, 3 weeks ago.

  • Author
    Posts
  • #16183

    Kasey
    Participant

    I have a cascading drop down with the :muli option on two fields. I need to make the second required based on the selected value of #1. I created a function for this which works but I cant figure out a way to trigger the function on the change of #1. Since it is multiple lines of text I cant use it as a trigger in an out of the box rule. Is there anything I can do to trigger my function when the selected options of #1 change?

    The requester also wants to limit the ability to select one of the options with any other option. I implemented an alert but if I could force clearing all selected options that would be better. I tried setFieldValue but that didn’t seem to impact the multi select casc. Is there a way to clear all selected options from a multi casc?

    //Non with others
    var highRiskProcess = $.trim(getFieldValue(“HighRiskProcess”));
    if(highRiskProcess.indexOf(“Non – No Process Alignment;”) != -1 && highRiskProcess !== “Non – No Process Alignment;”){
    alert(“You have selected a High Risk Process of Non – No Process Alignment with other High Risk Processes. Please remove Non – No Process Alignment”);
    setFieldValue(“HighRiskProcess”,””); //doesn’t work
    }

  • #16185

    Kasey
    Participant

    I figured out a method to call my function when adding/removing options which I have provided below. You may have a better option for me. I also figured out I can clear all selected options if I setFieldValue to “” and reinitialize my casc.

    $().ready(function () {
    checkForDOMAndCalculate();
    });

    function checkForDOMAndCalculate() {
    setTimeout(checkDOM, 100);
    }

    function checkDOM() {
    if( $(‘#HighRiskProcess_casc_btnRemove’).length ){
    $(“#HighRiskProcess_casc_btnAdd”).click(function() {highRiskProcess()});
    $(“#HighRiskProcess_casc_btnRemove”).click(function() {highRiskProcess()});
    }
    else{
    checkForDOMAndCalculate();
    }
    }

  • #16187

    Kasey
    Participant

    Actually, I cant get my second cascade selected options to clear for some reason. So if you have a way to reset all selected options to nothing please let me know.

  • #16189

    Kasey
    Participant

    Sorry, I figured out how to clear all options.

    spjs.casc.clear(“HighRiskProcess”,0)

  • #16222

    Alexander Bautz
    Keymaster

    Hi,
    Sorry for the late reply – did you figure it out, or still have questions?

    Alexander

    • #16226

      Kasey
      Participant

      I’m not sure if I’m doing it the most efficient way possible but yes, I did get it working.

  • #16253

    Alexander Bautz
    Keymaster

    If it’s working I think we leave it like that for now – I’m a bit busy with sorting out an issue with the latest DFFS BETA.

    Best regards,
    Alexander

You must be logged in to reply to this topic.