Hello,
I have a drop down list that is being populated from a selection of another drop down using the addItem script. This new drop down will only have two values.
Is it possible for a text field to be populated with the "non-selected" value from the drop down?
I attached the document here. The text fields will replace the A-G labeled drop down lists on the bottom of the doc.
Joe
Solved! Go to Solution.
Views
Replies
Total Likes
Hi,
I have changed the "A" from a dropdown to a textfield and changed the SOM in the script.
The main script you are looking for is in DropDownList4.
I have moved your addItem script from the enter event to the preOpen event, which is better for populating dropdowns. Also have a look at the script, because I have set bound values for both addItems, 0 and 1. This means that the user sees the team names, but the script can then reference the bound values.
The new script is in the exit event of the first match. This looks at the bound value of the selected item in the dropdown and then populates the "A" with the other teams name.
if (this.selectedIndex == "0")
{
TextField15.rawValue = this.getDisplayItem(1);
}
else
{
TextField15.rawValue = this.getDisplayItem(0);
}
I have the first one done, you should be able to follow for the others.
Good luck,
Niall
Views
Replies
Total Likes
I do not follow how you select "Loser to A-D" given all teams may appear in the drop-down. I made changes to impact the drop-downs highlighted in green, below, particularly the exit event on form1.Page1.EightTeams.DropDownList4.
// form1.Page1.EightTeams.DropDownList4::exit - (JavaScript, client)
form1.Page1.EightTeams.DropDownList22.clearItems();
var i = 0;
if (form1.Page1.EightTeams.DropDownList4.selectedIndex == 0) {
i = 1;
}
form1.Page1.EightTeams.DropDownList22.addItem(form1.Page1.EightTeams.DropDownList4.getDisplayItem(i));
Steve
Views
Replies
Total Likes
Hi,
I have changed the "A" from a dropdown to a textfield and changed the SOM in the script.
The main script you are looking for is in DropDownList4.
I have moved your addItem script from the enter event to the preOpen event, which is better for populating dropdowns. Also have a look at the script, because I have set bound values for both addItems, 0 and 1. This means that the user sees the team names, but the script can then reference the bound values.
The new script is in the exit event of the first match. This looks at the bound value of the selected item in the dropdown and then populates the "A" with the other teams name.
if (this.selectedIndex == "0")
{
TextField15.rawValue = this.getDisplayItem(1);
}
else
{
TextField15.rawValue = this.getDisplayItem(0);
}
I have the first one done, you should be able to follow for the others.
Good luck,
Niall
Views
Replies
Total Likes
This works perfectly. Thanks for your help!
Views
Replies
Total Likes
Views
Likes
Replies