HI All!
Need some help with some javascript. I have a form that has a radio button B that when you select it, shows a subform. Inside the subform is a table that has a dropdown list. The drop down list is populated based on a previous radio button A that was selected, and is a subset of possible values.
The user is able to click a button to create an additional instance of the subform. Problem is the new instance is in the original version of the subform, and the drop down list does not have the selected subset of values.
How can I have the dropdown in the added instance only show the subset drop down values?
Let me know if you need more info.
Thank you!
Jodi
Solved! Go to Solution.
Views
Replies
Total Likes
You must make sure to access the right instance of Awardees..
Because you create new instances, you must access them by using the method resolveNode()
you can access the instance by using 0 based indexes, if you are within the initalize event of the dropdown list you can just use "this" instead of "Main.PreApproved.Awardees.Table1.Row1.AwardType"
When adding an instance on the Button click event :
Dropdownlist initialize event :
If you change value on the radio button (which changes subset values):
Hope this help!
Views
Replies
Total Likes
Hi there,
you can insert script within the initialize or enter event which verifies if the length of the list is equal to 0 and then it adds the value within the dropdownlist
If you need to change the subset values, always remember to clear the items first
Hope this will help
Views
Replies
Total Likes
Which Initialize would I put it on? For the button that creates the additional instance of the subform?
Currently on the click even of the button I have this
Awardees.instanceManager.addInstance(1).presence = "visible";
I have tried to add an if statement after that saying
if (Main.Campus.Urbana.rawValue == "1")
{Main.PreApproved.Awardees.Table1.Row1.AwardType.rawValue = "";
Main.PreApproved.Awardees.Table1.Row1.AwardType.clearItems();
Main.PreApproved.Awardees.Table1.Row1.AwardType.addItem("Excellence in Faculty Mentoring Award");
Main.PreApproved.Awardees.Table1.Row1.AwardType.addItem("Excecutive Officer Distinguished Leadership Award");
Main.PreApproved.Awardees.Table1.Row1.AwardType.addItem("Outstanding Faculty Leadership Award");
Main.PreApproved.Awardees.Table1.Row1.AwardType.addItem("Campus Award for Excellence in Instruction");
Main.PreApproved.Awardees.Table1.Row1.AwardType.addItem("Chancellor's Academic Professional Excellence Award (CAPE)");
Main.PreApproved.Awardees.Table1.Row1.AwardType.addItem("Chancellor's Distinguished Staff Award");
Main.PreApproved.Awardees.Table1.Row1.AwardType.addItem("Service Recognition Award")}
But that isn't working?
Views
Replies
Total Likes
The initialize event of the dropdown list
Your goal is to keep each new instances of that dropdown list to keep the same list as all the others dropdown list, so when the dropdown list initialize itself,
you verify which subset values you want to add to the dropdown list by verifying urbana's value and then add it to the dropdown list
But what isnt working exactly? the code you just provided or you tried what I suggested?
Views
Replies
Total Likes
Hi Magus!
The code that I entered above wasn't working on the click event of the button that adds the additional instance.
So what I did was on the drop down list I tried the following on both the initialize and the enter event, and it still doesn't work.
if (Main.Campus.Urbana.rawValue == "1")
Main.PreApproved.Awardees.Table1.Row1.AwardType.rawValue = "";
Main.PreApproved.Awardees.Table1.Row1.AwardType.clearItems();
Main.PreApproved.Awardees.Table1.Row1.AwardType.addItem("Excellence in Faculty Mentoring Award");
Main.PreApproved.Awardees.Table1.Row1.AwardType.addItem("Excecutive Officer Distinguished Leadership Award");
Main.PreApproved.Awardees.Table1.Row1.AwardType.addItem("Outstanding Faculty Leadership Award");
Main.PreApproved.Awardees.Table1.Row1.AwardType.addItem("Campus Award for Excellence in Instruction");
Main.PreApproved.Awardees.Table1.Row1.AwardType.addItem("Chancellor's Academic Professional Excellence Award (CAPE)");
Main.PreApproved.Awardees.Table1.Row1.AwardType.addItem("Chancellor's Distinguished Staff Award");
Main.PreApproved.Awardees.Table1.Row1.AwardType.addItem("Service Recognition Award")}
Views
Replies
Total Likes
You must make sure to access the right instance of Awardees..
Because you create new instances, you must access them by using the method resolveNode()
you can access the instance by using 0 based indexes, if you are within the initalize event of the dropdown list you can just use "this" instead of "Main.PreApproved.Awardees.Table1.Row1.AwardType"
When adding an instance on the Button click event :
Dropdownlist initialize event :
If you change value on the radio button (which changes subset values):
Hope this help!
Views
Replies
Total Likes
YES! That did it! I used the first example you gave me. Thanks you so much Magus for the help!!!
Have a great weekend!
Jodi
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies