I have two dropdowns with two different sets of data. one with country and another with profession.
I have a listbox with the all the possible country/profession combined as a formattedvalue. how can I get the rawvalue/index using the formattedvalue from the two fields above.
I will pick a specific country and profession and then I need to get the index of that combo in the listbox.
Any help would be appreciated.
Solved! Go to Solution.
Views
Replies
Total Likes
I resolved my issues. here is the code I developed to get the job done. it could be simplified a little further but it worked well.
I put it in the enter action.
var checkValue = [dropdown1].rawValue + [dropdown2].formattedValue + ", "
var oArr = checkValue.split(", ");
var oList = xfa.resolveNode([listbox with the index and concat values].somExpression);
var oListIndex;
while (oArr.length!=0){
oListIndex = oList.boundItem(oArr.pop());
oList.setItemState(oListIndex-0,1);
}
NOTE: You can add if statement to make it run only if those fields have values right before the while statement.
Views
Replies
Total Likes
If I understand the request correctly, you want to get the values from the two dropdown lists and combine them to set the value in the list box. To do that the following script should suffice. You probably want to add some error handling but this should get you started
var d1 = DropDownList1.formattedValue
d1 = d1.concat(DropDownList2.formattedValue)
xfa.host.messageBox(d1)
ListBox1.rawValue = d1
Views
Replies
Total Likes
TundraSteve,
Not exactly, my main issue is to find the index value of the specific formattedvalue in the listbox. here is an example which hopefully will better explain:
DD1 - US, China, etc.
DD2 - Job1, Job2, etc.
Listbox -
1 | USJob1
2 | USJob2
3 | ChinaJob1
4 | ChinaJob2
By using the top two dropdowns, can I get the index value? so if someone picks China and Job1, I can get index 3? I know how to aggregate the formattedvalues.
Views
Replies
Total Likes
Why do you want the index value? What are you going to do with it? You could set the selection as I mentioned above and then use ListBox1.selectedIndex to get the index or if you don't want to set the value in the listbox just loop through the listbox items and compare to the combined dropdown values
Views
Replies
Total Likes
long story...the form is connected to a database but it is sent to a external contact where we want to validate real-time prices. so, we are pushing the data into multiple listboxs because they wouldnt have the db connection. after i get the index, i will know which value to use in another listbox (which is defined depending on another dropdown selection)
Can you help me understand how you would compare the combined dropdown? my one other issue is they could manually type a country and if we do not have the rates, it will not validate the pricing. This is needed because we do business globally.
Views
Replies
Total Likes
I resolved my issues. here is the code I developed to get the job done. it could be simplified a little further but it worked well.
I put it in the enter action.
var checkValue = [dropdown1].rawValue + [dropdown2].formattedValue + ", "
var oArr = checkValue.split(", ");
var oList = xfa.resolveNode([listbox with the index and concat values].somExpression);
var oListIndex;
while (oArr.length!=0){
oListIndex = oList.boundItem(oArr.pop());
oList.setItemState(oListIndex-0,1);
}
NOTE: You can add if statement to make it run only if those fields have values right before the while statement.
Views
Replies
Total Likes
additionally, the above code was used to figure out what the index was for a specific formattedvalue in a listbox. here is the code which I used to use it to look up a value in another listbox.
check = xfa.resolveNode([listbox 2 which has the value you need).getDisplayItem([listbox1 where you selected the formattedvalue in the code above]); |
Views
Likes
Replies
Views
Likes
Replies