I have a drop down menu that receives it's values from a text box that concatenates values from a database. These values are comma delimited in a string and turned into items in the drop down of the Thom Parker style.
I'm receiving some requests from form users to do two things here, however. The first is this:
When you click the drop down to see the options, if you click "C", it brings you to the first item that starts with "C". That's good, but it stops there. If I go to a web page that asks me for my state, and I'm from Colorado, I can usually expect to type "Co" in a quick keystroke and be brought to my state.
The way that this form works, it will first go to California when I hit "C", then shoot off to Ohio on the "O" keystroke. This appears to be the default behavior of LCD drop downs.
With the number of employees that we have, we need our drop down to have more lookup functionality.
Can anyone think of a work around of some sort, or perhaps get me started on how to javascript this to work correctly?
Second question.
I want to make the items in the drop down sort alphabetically after the lookup. Here's the code I used.
var textFeed = form1.catchers.emp_name_catch var valFeed = form1.catchers.emp_no_catch var sChoice = textFeed.rawValue; var sVal = valFeed.rawValue; if (sChoice == null) sChoice = ""; if (sVal == null) sVal = ""; if (sChoice.length > 0) { // Set the contents of the this drop-down list box // equal to list in the emp_name_catch text box. // This is required when the form is opened for the very // first time. // Populate action list array from the comma delimited string in emp_name_catch var astrChoiceList; var astrValList; var choices; var Vals // Clear drop-down list box this.clearItems(); astrChoiceList = textFeed.rawValue; astrValList = valFeed.rawValue; // add each choice to this choices = astrChoiceList.split(","); Vals = astrValList.split(","); var numchoices = choices.length; for (var i = 0; i < numchoices; i++) { this.addItem(choices[i], Vals[i]); } }
I believe right after
this.addItem(choices[i], Vals[i]);
I need some sort of code that then resorts them again, this way I don't lose my bindings. I can't find any reference to the right syntax, but I imagine it starts with
this.items(...
Or something like this. Any help is appreciated.
But there's a problem. The selection list needs to be open. Ok fine, so you'd think if I used this code:
xfa.host.openList("dropdownlistname");
And put this in the "enter" event of the drop down list, it would work. Well it doesn't. No idea why. Now if I insert that same code into MouseEnter, it works great, except that's incredibly inconvenient when the things pop up in your face when you're mousing past.
Why doesn't this work on the "enter" event? I saw some compatibility change notes between version 6 and 7, but I don't see how an addition of a "reenter" property would change that too much.