Click to See Complete Forum and Search --> : Search text in options box


NatuScape
03-09-2003, 03:36 PM
Hello all!

I've spent the better half of the past hour trying to catch a snippet of code on the web that will search for a string (the user enters it in a form) among options in a selection box in the same page (a separate form) and will then jump to the first option that contains that search string, but nope.. no luck!! Does anyone have any such snippet to share with me?

Thanks in advance for the cooperation!

Natalia

P.S.: Does anyone know how to cookie oneself on this site so I don't have to log on every time?

khalidali63
03-09-2003, 04:27 PM
Would something like this work for you...

http://68.145.35.86/skills/javascripts/SearchValueInListBox.html

:D

Cheers

Khalid

NatuScape
03-09-2003, 06:36 PM
Yup! That's exactly what I need... but it doesn't seem to work in the link you sent me, is there any change to the code I need to make?

Thanks a bunch!!

Natalia

khalidali63
03-09-2003, 07:12 PM
Not really,If does what you want,then why mess with it...:-)

Khalid

NatuScape
03-09-2003, 07:47 PM
My point exactly!! It DOESN'T do what I want... because it doesn't work!! I mean, I type bar for Barbados, hit the button and it doesn't get selected... So I wonder: is there something missing in the code? Or is there an obscure setting in my browser I missed? All other JS script I tried works...

Thanks again!!!!!!!!!

Natalia

khalidali63
03-09-2003, 07:53 PM
It does work....I have tested it on both IE6+ and NS6+ browsers.
The error is at your end...try a different browser or check your settings..

Khalid

pyro
03-09-2003, 08:07 PM
It worked just fine for me in IE6...

NatuScape
03-09-2003, 08:19 PM
Ahhh!!!! Now I get it... I was not capitalizing the first letter I entered in the text box... is it possible to fix the code so that it won't care for upper or lower case?? Also, I'd need for it to search in any part of the option text, not just the beginning...

Thanks again both Khalid and Pyro and sorry if I came on a bit "snotty"!!!! :rolleyes:

Natalia

khalidali63
03-09-2003, 08:30 PM
I have fixed the code,It matches the part of the code with the full value and if matched selects it,as well as it will convert everything to lower case now before testing it

Khalid

NatuScape
03-09-2003, 08:33 PM
FAAAAAAAANTASTIC!!!

Thanks a million Khalid!!!! :)

Natalia