Connecting Tech Pros Worldwide Help | Site Map

combox not showing same records every time

 
LinkBack Thread Tools Search this Thread
  #1  
Old March 3rd, 2007, 06:05 AM
hygum
Guest
 
Posts: n/a
Default combox not showing same records every time

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?


  #2  
Old March 3rd, 2007, 06:35 AM
OmegaJunior
Guest
 
Posts: n/a
Default 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/
  #3  
Old March 3rd, 2007, 08:15 AM
hygum
Guest
 
Posts: n/a
Default 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

  #4  
Old March 5th, 2007, 09:25 AM
j.andersen
Guest
 
Posts: n/a
Default 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

  #5  
Old March 6th, 2007, 06:05 AM
hygum
Guest
 
Posts: n/a
Default 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

 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.