Home › Forums › Cascading dropdowns › CASC :multi on change?
- This topic has 6 replies, 2 voices, and was last updated 7 years, 8 months ago by Alexander Bautz.
-
AuthorPosts
-
-
March 23, 2017 at 00:09 #16183
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
} -
March 23, 2017 at 01:00 #16185
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();
}
} -
March 23, 2017 at 01:54 #16187
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.
-
March 23, 2017 at 02:03 #16189
Sorry, I figured out how to clear all options.
spjs.casc.clear(“HighRiskProcess”,0)
-
March 27, 2017 at 21:33 #16222
Hi,
Sorry for the late reply – did you figure it out, or still have questions?Alexander
-
March 27, 2017 at 21:36 #16226
I’m not sure if I’m doing it the most efficient way possible but yes, I did get it working.
-
-
March 29, 2017 at 19:57 #16253
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
-
-
AuthorPosts
- You must be logged in to reply to this topic.