www.webdeveloper.com
Results 1 to 3 of 3

Thread: text box and drop down menus

  1. #1
    Join Date
    Nov 2007
    Posts
    36

    text box and drop down menus

    I am new to javascript so I am sure I am completely missing something. I could post my script but its kind've big and clunky, but I'll post it on request. I was wondering if some one could just show me an example of a drop down menus value being added to the end of a text box value when submitted.

    for example:

    textbox value="a"
    dropdown value="2"

    so when submitted it submits as "a2"

    thanks.

  2. #2
    Join Date
    May 2006
    Location
    North of the South Pole
    Posts
    590
    Try something like this:

    HTML Code:
    <form action="script.php" onsubmit="combineValues();">
    <input type="text" id="temptext" />
    <select id="tempselect">
    <option value="1">1</option>
    <option value="2">2</option>
    <option value="3">3</option>
    </select>
    <input type="text" id="combinedvalue" />
    </form>
    Code:
    function combineValues(){
    document.getElementById("combinedvalue").value = document.getElementById("temptext").value+document.getElementById("tempselect").options[document.getElementById("tempselect").selectedIndex].value;
    }
    "I have no special talent. I am only passionately curious." Albert Einstein

  3. #3
    Join Date
    Nov 2007
    Posts
    36
    thanks, i was able to get that part of my script working. i appreciate it.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles