Is there a way to have the script ignore upper and lower case?
I have a script that creates an array of the dropdown items then compares the users input to see if there is a match. The user needs to know to capitilize the first letter or a match will not be found. I want the script to find a match even if they do not capitalize the first letter. here's the script:
// Check that the user has not typed in a value
// that does not exist in the list. If they have
// then clear the dropdown.// First create an array of the items in the
// dropdown list.
var vUserInput = [];
for (var i=0; i<this.length; i++) {
vUserInput.push(this.getDisplayItem(i));
}// Check that the value is not in the array
if (this.rawValue !== null && vUserInput.lastIndexOf(this.rawValue) === -1) {
this.rawValue = null; // clear the dropdown
xfa.host.beep("3"); // audio alert to the user
this.ui.oneOfChild.border.fill.color.value = "255,225,225"; // red
}
Solved! Go to Solution.
Views
Replies
Total Likes
OK,
then you can use the sample from Bruce, which already does what you're looking for.
http://forums.adobe.com/message/2372156#2372156#2372156#2372156 (it's the countries.pdf and xml)
Views
Replies
Total Likes
Why not just uppercase or lowercase the values when comparing then you don't have to worry about the case the user enters
Views
Replies
Total Likes
I guess I am not sure how to do what you are suggesting. Are you saying to write a script that changes the users entry to upper case and then one that changes it to lower case? and compare both?
What function/script changes the case of the users entry?
Views
Replies
Total Likes
I tried the following but it does not work.
var vUserInput = toTitleCase([]);
for (var i=0; i<this.length; i++) {
vUserInput.push(this.getDisplayItem(i));
}
Views
Replies
Total Likes
this.getDisplayItem(i).toUpperCase() will push the uppercase into the array. Then the compare would be to this.rawValue.toUpperCase(). Thus the compare would be all uppercase removing the case sensitivity
Views
Replies
Total Likes
This is what I have but I can't get it to work... what do I have wrong?
var vUserInput = [];
for (var i=0; i<this.length; i++) {
vUserInput.push(this.getDisplayItem(i).toUpperCase());
}// Check that the value is not in the array
if (this.rawValue !== null && vUserInput.lastIndexOf(this.rawValue.toUpperCase()) === -1) {
this.rawValue = null; // clear the dropdown
xfa.host.beep("3"); // audio alert to the user
this.ui.oneOfChild.border.fill.color.value = "255,225,225"; // red
Views
Replies
Total Likes
I seperated the top section of the script from the bottom and this part will not work.
var vUserInput = [];
for (var i=0; i<this.length; i++){
vUserInput.push(this.getDisplayItem(i).toUpperCase());
}
Can you help?
Views
Replies
Total Likes
Can anyone help me with this?
Views
Replies
Total Likes
What are you trying to do with your dropdown?
Do you want something like a find-as-type method?
Does the dropdown allow custom entries?
Views
Replies
Total Likes
Yes - I have script that opens the dropdown list when the focus is on that dropdown object. We need the user to be able to start typing the first letter or two to shorten the list. We wanted it to work regardless if they type lower or uppercase letters. Yes - it allows custom entries.
Views
Replies
Total Likes
OK,
then you can use the sample from Bruce, which already does what you're looking for.
http://forums.adobe.com/message/2372156#2372156#2372156#2372156 (it's the countries.pdf and xml)
Views
Replies
Total Likes
Thanks very much.
Views
Replies
Total Likes
Views
Like
Replies
Views
Likes
Replies
Views
Likes
Replies