Drop-Down/Text Box Combination?

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

    #1

    Drop-Down/Text Box Combination?

    I am a javascript newbie and did not see anything quite like this in
    sections 1-5 of the FAQ or on a Google search.

    Is there a generic javascript example of a compound drop-down/text box,
    i.e., if the user selects an item from the drop-down, the selected item
    populates the text box, but the user can also type their own ad-hoc
    value into the text box if desired?

    I would like to include such a control in a php/mysql web form I am
    developing.

  • @SM

    #2
    Re: Drop-Down/Text Box Combination?

    bonehead a ecrit :
    [color=blue]
    > I am a javascript newbie and did not see anything quite like this in
    > sections 1-5 of the FAQ or on a Google search.
    >
    > Is there a generic javascript example of a compound drop-down/text box,
    > i.e., if the user selects an item from the drop-down, the selected item
    > populates the text box, but the user can also type their own ad-hoc
    > value into the text box if desired?[/color]

    <form>
    <input type=text name="truc">
    <select onchange= if(this.options .selectedIndex= =0)
    alert('Do an other choice');
    else
    this.form.truc. value=this.opti ons[this.options.se lectedIndex].value;">
    <option selected>Choisi r une ville - Select a Town
    <option value="Paris">P aris
    <option value="London"> Londres - London
    <option value="Tokio">T okio
    </select>
    </form>
    [color=blue]
    > I would like to include such a control in a php/mysql web form I am
    > developing.[/color]

    ???? pas ni compris - Not do unterstand - Yo no comprender
    You make choice by menu
    Then you can change the value of text
    The php will receive the value of "truc" ( $truc )



    Comment

    • bonehead

      #3
      Re: Drop-Down/Text Box Combination?

      Thanks
      @SM wrote:[color=blue]
      > bonehead a ecrit :
      >
      >[color=green]
      >>I am a javascript newbie and did not see anything quite like this in
      >>sections 1-5 of the FAQ or on a Google search.
      >>
      >>Is there a generic javascript example of a compound drop-down/text box,
      >>i.e., if the user selects an item from the drop-down, the selected item
      >>populates the text box, but the user can also type their own ad-hoc
      >>value into the text box if desired?[/color]
      >
      >
      > <form>
      > <input type=text name="truc">
      > <select onchange= if(this.options .selectedIndex= =0)
      > alert('Do an other choice');
      > else
      > this.form.truc. value=this.opti ons[this.options.se lectedIndex].value;">
      > <option selected>Choisi r une ville - Select a Town
      > <option value="Paris">P aris
      > <option value="London"> Londres - London
      > <option value="Tokio">T okio
      > </select>
      > </form>
      >[color=green]
      >>I would like to include such a control in a php/mysql web form I am
      >>developing.[/color]
      >
      >
      > ???? pas ni compris - Not do unterstand - Yo no comprender
      > You make choice by menu
      > Then you can change the value of text
      > The php will receive the value of "truc" ( $truc )
      >
      >
      >[/color]

      Comment

      • dennis.sellinger

        #4
        Re: Drop-Down/Text Box Combination?

        The simple answer is there is no combo box control in HTML. There is a
        SELECT element, but this lacks the text box part of the combo box. Recently
        I went looking for a combo box control myself. I found two, the first is
        at



        It seems to be really slick but it did not layout well with respect to the
        rest of my form (which was laid out in a simple table).

        I also found a commercial control at:



        which ooks to be good, but I am not interested in buying a combo box.

        In the end I just hacked up a control by implementing a button -
        input(text) - button combination of un-named items in a form (with a named
        hidden input) holding my final value. I used an (IE specific) IFRAME
        containing a table to represent the drop down menu, that could be hidden
        using CSS display/visibility. I create the menu dynamically using script
        (in much the same way that the webfx control does).

        I strongly suggest you look at the we control as it work very well is is
        very well coded.

        Hope this helps.

        d.


        Comment

        Working...