Re: question about javascript and textboxes for Pros

by David Mintz <mambomintz(at)yahoo.com>

 Date:  Tue, 9 Jan 2001 08:07:58 -0800 (PST)
 To:  hwg-languages(at)hwg.org
  todo: View Thread, Original

I'm no Javascript genius but I'll take a shot anyway.

I'd say rethink your strategy. Hard-code the 804A part
of the number into your html and have the select
options be the rest of the number, like so

Number: 804A<select name="number">
<option>10000</option>
<option>13000</option>
<option>12344</option>
...
</select>

It should be pretty easy for to strip the 804A off
your numbers programmatically (e.g., have your SQL
statement fetch the substring starting with the fifth
character). You could also leave the whole number
intact as your options' value attribute and just
shorten the text portion, to save some work when you
use the user's choice to execute a query against your
database.

Now where's my beer? I'm fond of Guinness.

--- Siim Einfeldt aka Itpunk <siim_e(at)pshg.edu.ee>
wrote:
> 
> hi again,
> 
> I have a form, inside it I have a dropdown menu
> (<SELECT>), inside it I
> have couple of hundred options, which come directly
> from the database. All
> the option have the same type, eg they all start
> with 804A and then comes
> some number, so they look like
> 804A10000
> 804A13000
> 804A12344
> etc.
> 
> What I need to do: When someone activates the select
> box (click on
> it..) and then typessome number, then the script
> should start looking gof
> that number BEGINNING FROM the fifth character, not
> the first, and
> then make the first found value selected ...

__________________________________________________
Do You Yahoo!?
Yahoo! Photos - Share your holiday photos online!
http://photos.yahoo.com/

HWG: hwg-languages mailing list archives, maintained by Webmasters @ IWA