combox not showing same records every time

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • hygum

    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?

  • OmegaJunior

    #2
    Re: combox not showing same records every time

    On Sat, 03 Mar 2007 07:54:00 +0100, hygum <thomashygum@gm ail.comwrote:
    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/

    Comment

    • hygum

      #3
      Re: combox not showing same records every time

      On 3 Mar., 08:27, OmegaJunior <omegajun...@sp amremove.home.n lwrote:
      On Sat, 03 Mar 2007 07:54:00 +0100, hygum <thomashy...@gm ail.comwrote:
      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/
      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

      Comment

      • j.andersen

        #4
        Re: combox not showing same records every time

        On Mar 3, 8:54 am, "hygum" <thomashy...@gm ail.comwrote:
        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.

        Code:
        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

        Comment

        • hygum

          #5
          Re: combox not showing same records every time

          On 5 Mar., 11:17, "j.andersen " <j.andersen...@ gmail.comwrote:
          On Mar 3, 8:54 am, "hygum" <thomashy...@gm ail.comwrote:
          >
          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.
          >
          Code:
          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

          Comment

          Working...