[Javascript] in response to "add a new entry in a drop down menu"

Smitha Ramaswamy smitha.ramaswamy at wipro.com
Wed Jun 25 03:45:57 CDT 2003


FiestaWell,I really dont see too much difference between the SELECT and the
combo box wrt JAVASCRIPT as both are used in tandem.But as Walter rightly
pointed out,the difference is more obvious in a VB form I guess.
Anyways,coming to the problem,in fact there is a work around for this.
If the requirement is that the user should be able to create a new item by
keying in info,it can be done with this workaround:
Create a text box wherein the user keys in the info.Onclick of a button or
onBlur of that particular text field, a JS function can be invoked which
will do the "new option" creation as mentioned earlier.
There is always a way...:-)...

Pat Gorden-Ozgul ...if you need code for what i mentioned above,please let
me know..will post the same in my next email.
I hope our discussion has been of some help to you in solving your problem.

Regards,
Smitha.
  -----Original Message-----
  From: javascript-bounces at LaTech.edu
[mailto:javascript-bounces at LaTech.edu]On Behalf Of Walter Torres
  Sent: Wednesday, June 25, 2003 11:55 AM
  To: [JavaScript List]
  Subject: RE: [Javascript] in response to "add a new entry in a drop down
menu"


  Not to be too picky, but a SELECT Element in HTML is *not* a combo-box.

  A "combo-box" is a VB Object that lists you, the user-not the developer,
create a new item to a pick list by keying the info right a the pick list.

  An HTML SELECT Element does not have that "feature" (Boy! I wish it did!)

  So, your example is nice "one liner", it does not make the SELECT a combo
box.

  You really had me excited when I was reading this thread about
"dynamically adding an item in a combo-box".

  I was eager to see the solution.

  But alas...

  Anyway, as I said, nice "one-liner"

  jsWalter [still eagerly wishing for a true combo-box]

  So,
    -----Original Message-----
    From: javascript-bounces at LaTech.edu
[mailto:javascript-bounces at LaTech.edu]On Behalf Of Smitha Ramaswamy
    Sent: Wednesday, June 25, 2003 12:00 AM
    To: [JavaScript List]
    Subject: RE: [Javascript] in response to "add a new entry in a drop down
menu"
    Importance: High


    Hi,

    I have attached a very simple html with JS code that will enable you to
add a new element to the combo box.
    I hope this is of some help to you.Do get back to me in case of any
queries.

    <HTML>
    <HEAD>
    <TITLE> New Document </TITLE>
    <META NAME="Generator" CONTENT="EditPlus 1.2">
    <META NAME="Author" CONTENT="">
    <META NAME="Keywords" CONTENT="">
    <META NAME="Description" CONTENT="">
    </HEAD>

    <BODY BGCOLOR="#FFFFFF">
    <FORM>
    <SELECT NAME="test">
    <option value="1">one</option>
    <option value="2">two</option>
    </SELECT>

    <SCRIPT LANGUAGE="JavaScript">

document.forms[0].test.options[document.forms[0].test.options.length] = new
Option('three','3')
    </SCRIPT>

    </FORM>
    </BODY>
    </HTML>


    Regards,
    Smitha

**************************Disclaimer************************************

Information contained in this E-MAIL being proprietary to Wipro Limited is 
'privileged' and 'confidential' and intended for use only by the individual
 or entity to which it is addressed. You are notified that any use, copying 
or dissemination of the information contained in the E-MAIL in any manner 
whatsoever is strictly prohibited.

***************************************************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20030625/c05b45de/attachment.htm>


More information about the Javascript mailing list