A form with two drop down lists.
First ddlist is called "Model"
List items are: Model1, Model2, Model3, & Model4
Second ddlist is called "Engines"
This has list items: Engine1, Engine2, Engine3, & Engine4.
How can I code this, so that when Model1 is selected in the first ddlist, the second ddlist only has list items "Engine1" & "Engine2" ?
(The only engine options available for Model1)
...and when Model2 is selected in the Model ddlist, the Engine ddlist only displays "Engine3" & "Engine4" ?
Not sure if this requires a script object, or an array of some kind? Either way, I am not sure how to do it, and would love some help from the experts!
Many Thanks
Solved! Go to Solution.
Views
Replies
Total Likes
The attached contains a sample with linked drop-downs for models and engines as described. It uses a combination of events and a script object.
Steve
Views
Replies
Total Likes
The attached contains a sample with linked drop-downs for models and engines as described. It uses a combination of events and a script object.
Steve
Views
Replies
Total Likes
Thanks Steve, that exactly what I was trying to do.
Views
Replies
Total Likes
This works fine, but I now need to make a subform visible when a particular engine selection is made.
Because there are no list items (as they are in the script object) is makes it hard to set an action on the engine ddlist to make the subform visible?
I was hoping to do something like:
if (xfa.event.newText == "Engine1") {
this.resolveNode("subform1").presence = "visible";
}
Views
Replies
Total Likes
Use this script in the layout ready:Event of the subform.
this.presence = DDL.rawValue == "Engine1"? "visible":"hidden";
Views
Replies
Total Likes
Thanks radzmar, but that does not appear to work for me?
Views
Replies
Total Likes
Make sure you use JavaScript as script language.
Also, you may have to use the resolveNode method to resolve the full path of the DDL.
1. Enter the script into the layoutReady:event of the subform and place the text cursor at the position with the x. (x does not belong to the script)
this.presence = x.rawValue === "Engine1"? "hidden":"visible";
2. Now press and hold down ctrl + shift and move the mouse cursor over the DDL until a down arrow ˅ will appear, then click the left mouse button.
Designer will add the neccessary part to resolve the path to the DDL to your script.
this.presence = xfa.resolveNode("Form1.#subform.DDL").rawValue === "Engine1"? "hidden":"visible";
Views
Replies
Total Likes