Dynamic TextField Drop Down Pre-fill

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

    Dynamic TextField Drop Down Pre-fill

    Hello,

    I was wondering if the following scenario can be done using plain
    Javascript or AJAX. We have an input text box within a form. As soon
    as the user starts typing in character into that text box possible
    options dynamically appear below that text box so that the user can
    simply select an option rather than typing the rest of the data. For
    example, in gmail as soon as you start typing in characters into the
    To: field (or CC: field or BCC: field) email addresses that start with
    the user typed characters dynamically appear. Then the user can
    simply select the best match rather than typing in the entire email
    address.

    I know that this can be done using AJAX and some fancy CSS, but I was
    wondering if this can be done without AJAX, i.e. with just plain
    Javascript and CSS? If this can only be done with AJAX, what would it
    take to throw up AJAX on Tomcat/iPlanet web servers?

    Thanks,
    --Willard
  • Henry

    #2
    Re: Dynamic TextField Drop Down Pre-fill

    On Feb 21, 5:00 pm, Chuck wrote:
    I was wondering if the following scenario can be done using
    plain Javascript or AJAX. We have an input text box within
    a form. As soon as the user starts typing in character into
    that text box possible options dynamically appear below that
    text box so that the user can simply select an option rather
    than typing the rest of the data.
    Remember to think about what happens when/if the user starts deleting
    characters.
    I know that this can be done using AJAX and some fancy CSS,
    The CSS is largely irrelevant, as it only influences how the end
    result looks.
    but I was wondering if this can be done without AJAX, i.e.
    with just plain Javascript and CSS?
    If you mean client-side javascript then the problem is the data from
    which the choices are offered. For client-side javascript to present
    the suggestions it would need to have access to the data and so the
    data would have to be transmitted to the client in full. For any
    worthwhile system that would be an insane practice.
    If this can only be done with AJAX, what would it take to
    throw up AJAX on Tomcat/iPlanet web servers?
    Remember that AJAX (as it is usually thought of) is just a means of
    making HTTP request from client-side javascript (and receiving/working
    with the responses). The server is doing nothing more than a server
    would usually do; receiving HTTP requests and sending responses. There
    would have to be code on the server (servlets/JSPs or the like) to
    receive the requests, work out what to suggest (from the database, or
    somewhere), and send the lists of suggestions back to the client-side
    code for presentation.

    Comment

    • Joost Diepenmaat

      #3
      Re: Dynamic TextField Drop Down Pre-fill

      Chuck <willardthompso n@gmail.comwrit es:
      I know that this can be done using AJAX and some fancy CSS, but I was
      wondering if this can be done without AJAX, i.e. with just plain
      Javascript and CSS?
      Yes it can. But the reason you mainly see this as an Ajax solution is
      that it's only really useful if the list of possible options is too long
      to realistically send to the browser and navigate using standard form
      elements.

      If your option list isn't that long, you generally don't even need
      javascript: a simple <selectbox would work too - and most browsers
      already provide simple keyboard navigation on that.
      If this can only be done with AJAX, what would it
      take to throw up AJAX on Tomcat/iPlanet web servers?
      Nothing special. You just need an url that can be queried and will
      return the options in a useful format. Any dynamic web server platform
      should already have everything you need.

      --
      Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/

      Comment

      Working...