Home › Forums › Cascading dropdowns › Set the value of a Cascading dropdown field
Tagged: set value
- This topic has 6 replies, 3 voices, and was last updated 4 years, 6 months ago by Alexander Bautz.
-
AuthorPosts
-
-
October 11, 2019 at 15:27 #27313
Is this possible?
I currently have this CustomJS running:spjs.casc.init( { "manualMode":true, "dataSource":"", "lookupList":"LL_Centers", "lookupListBaseUrl":"{currentsite}", "lookupListFields":["Command","Title"], "thisListFields":["EventCommandLookup","EventOrgLookup"], "dropDownDefaultvalue":"Select...", "filter":"", "hideEmptyDropdowns":false, "autoselectSingleOption":true, "clearInvalidSelection":false, "addOwnValue":false, "addOwnValueMouseover":"", "cancelOwnValueMouseover":"", "sideBySide":false, "debug":false } );
Works fine, but when I create a rule that sets the EventCommandLookup field to a value, it doesn’t work. How do I identify values for the Cascading dropdowns?
- This topic was modified 5 years, 1 month ago by Therman.
-
October 11, 2019 at 15:51 #27318
So it looks like “EventCommandLookup” is working like normal. I actually had my value misspelled. But “EventOrgLookup” isn’t working.
-
October 13, 2019 at 09:35 #27322
Setting a cascading dropdown field is easiest done before the cascading dropdown function is initiated – values are then automatically set if the script finds the values as valid options.
If you want to set it after it is initiated you must first ensure the field is filled with the available options, and then set the value using:
setFieldValue("your_field_name","the_selected_value");
The problem is that when selecting the first level, the function to retrieve the options for the next level needs some time to finish before you can set the next value.
I’ll include a callback function in the next release that lets you trigger a function when the values for the next level is ready.
Alexander
-
October 13, 2019 at 12:48 #27324
How would I write that line of code you suggested on the rules tab? Do I choose my field from the drop-down and write your suggestion in the value field?
-
October 14, 2019 at 06:58 #27328
This code must be added in Custom JS. Create a function with your code and call it from Run these functions / trigger these rules in a rule.
Alexander
-
May 7, 2020 at 19:30 #29874
Alex, have you implemented the callback on the getFieldValue function?
-
May 7, 2020 at 20:43 #29878
-
-
-
AuthorPosts
- You must be logged in to reply to this topic.