Connecting Tech Pros Worldwide Help | Site Map

combox not showing same records every time

hygum
Guest
 
Posts: n/a
#1: Mar 3 '07
I have a combobox on this testsite: sneleopard.dk/combobox.html
it should show all records containing the search string while typing.
But sometimes it only shows some of them, why?
1) type "spi" and it shows among others "spinat helbladet"
2) delete the search string and type "bla"
3) it should now among others show "spinat helbladet" again, but it
doesnt, why?

maybe its because that the function shows first records starting with
the search string, and thereafter those containing?

OmegaJunior
Guest
 
Posts: n/a
#2: Mar 3 '07

re: combox not showing same records every time


On Sat, 03 Mar 2007 07:54:00 +0100, hygum <thomashygum@gmail.comwrote:
Quote:
I have a combobox on this testsite: sneleopard.dk/combobox.html
it should show all records containing the search string while typing.
But sometimes it only shows some of them, why?
1) type "spi" and it shows among others "spinat helbladet"
2) delete the search string and type "bla"
3) it should now among others show "spinat helbladet" again, but it
doesnt, why?
>
maybe its because that the function shows first records starting with
the search string, and thereafter those containing?
>
It's a problem with the commas. Try it with "baby" or "frisk": you won't
find "spinat, baby, frisk".

--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
hygum
Guest
 
Posts: n/a
#3: Mar 3 '07

re: combox not showing same records every time


On 3 Mar., 08:27, OmegaJunior <omegajun...@spamremove.home.nlwrote:
Quote:
On Sat, 03 Mar 2007 07:54:00 +0100, hygum <thomashy...@gmail.comwrote:
Quote:
I have a combobox on this testsite: sneleopard.dk/combobox.html
it should show all records containing the search string while typing.
But sometimes it only shows some of them, why?
1) type "spi" and it shows among others "spinat helbladet"
2) delete the search string and type "bla"
3) it should now among others show "spinat helbladet" again, but it
doesnt, why?
>
Quote:
maybe its because that the function shows first records starting with
the search string, and thereafter those containing?
>
It's a problem with the commas. Try it with "baby" or "frisk": you won't
find "spinat, baby, frisk".
>
--
Using Opera's revolutionary e-mail client:http://www.opera.com/mail/
yes I do. With baby or frisk i find that record. The commas are
escaped in the javascript array. But still it can be a comma
problem... I will try without

j.andersen
Guest
 
Posts: n/a
#4: Mar 5 '07

re: combox not showing same records every time


On Mar 3, 8:54 am, "hygum" <thomashy...@gmail.comwrote:
Quote:
I have a combobox on this testsite: sneleopard.dk/combobox.html
it should show all records containing the search string while typing.
But sometimes it only shows some of them, why?
1) type "spi" and it shows among others "spinat helbladet"
2) delete the search string and type "bla"
3) it should now among others show "spinat helbladet" again, but it
doesnt, why?
I changed your function, so that the array search is done once in one
loop only and it gives me none of the problems above.

Expand|Select|Wrap|Line Numbers
  1. for(i = 0; i < functionListLength; i++)
  2. {
  3. if( ( functionlist[i].search(re1) >= 0 ) ||
  4. ( functionlist[i].search(re2) >= 0 ) )
  5. {
  6. selectObj[numShown] = new Option(functionlist[i],comboids[i]);
  7. numShown++;
  8. }
  9. }
  10.  
You will have to clean up the variables not used, like
"visteelementer".

In my opinion you can leave out the first criteria (first search) as
the second criteria will find also those who starts with the search
string!

Best wishes,
John, Latvia

hygum
Guest
 
Posts: n/a
#5: Mar 6 '07

re: combox not showing same records every time


On 5 Mar., 11:17, "j.andersen" <j.andersen...@gmail.comwrote:
Quote:
On Mar 3, 8:54 am, "hygum" <thomashy...@gmail.comwrote:
>
Quote:
I have a combobox on this testsite: sneleopard.dk/combobox.html
it should show all records containing the search string while typing.
But sometimes it only shows some of them, why?
1) type "spi" and it shows among others "spinat helbladet"
2) delete the search string and type "bla"
3) it should now among others show "spinat helbladet" again, but it
doesnt, why?
>
I changed your function, so that the array search is done once in one
loop only and it gives me none of the problems above.
>
Expand|Select|Wrap|Line Numbers
  1. for(i = 0; i < functionListLength; i++)
  2. {
  3.    if( ( functionlist[i].search(re1) >= 0 ) ||
  4. ( functionlist[i].search(re2) >= 0 ) )
  5.    {
  6.       selectObj[numShown] = new Option(functionlist[i],comboids[i]);
  7.       numShown++;
  8.    }}
  9. >
  10.  
>
You will have to clean up the variables not used, like
"visteelementer".
>
In my opinion you can leave out the first criteria (first search) as
the second criteria will find also those who starts with the search
string!
>
Best wishes,
John, Latvia
i know the second search find the same as the first (but not the
reverse), but thats because i want the list to be first the records
that begins with the search string, and thereafter the records that
contains.

Thanks for your help

Closed Thread