combox not showing same records every time 
March 3rd, 2007, 06:05 AM
| | | 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? | 
March 3rd, 2007, 06:35 AM
| | | 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/ | 
March 3rd, 2007, 08:15 AM
| | | 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 | 
March 5th, 2007, 09:25 AM
| | | 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. -
for(i = 0; i < functionListLength; i++)
-
{
-
if( ( functionlist[i].search(re1) >= 0 ) ||
-
( functionlist[i].search(re2) >= 0 ) )
-
{
-
selectObj[numShown] = new Option(functionlist[i],comboids[i]);
-
numShown++;
-
}
-
}
-
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 | 
March 6th, 2007, 06:05 AM
| | | 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.
> -
for(i = 0; i < functionListLength; i++)
-
{
-
if( ( functionlist[i].search(re1) >= 0 ) ||
-
( functionlist[i].search(re2) >= 0 ) )
-
{
-
selectObj[numShown] = new Option(functionlist[i],comboids[i]);
-
numShown++;
-
}}
-
>
-
>
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 | | Thread Tools | Search this Thread | | | |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is Off | | | | | | 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.
|