www.webdeveloper.com
Results 1 to 2 of 2

Thread: Passing Values From Select Box to Text Area

  1. #1
    Join Date
    Aug 2006
    Posts
    1

    Passing Values From Select Box to Text Area

    I am trying to pass values to a text box from a select box. I have variables that I want users to be able to click on and enter in while they are typing text. I got it to work with this code, but it replaces the text that you are typing.

    PHP Code:
    <SCRIPT LANGUAGE="JavaScript">
    <!-- 
    Begin
    oldvalue 
    "";
    function 
    passText(passedvalue) {
      if (
    passedvalue != "") {
        var 
    totalvalue oldvalue+passedvalue;
        
    document.form.text_1.value totalvalue;
        
    oldvalue document.form.text_1.value;
      }
    }
    //  End -->

    </script>

    <form method="post" action="import.php" name="form">
                            <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="73%" class="text">1st Paragraph</td>
        <td width="27%">&nbsp;</td>
      </tr>
      <tr>
        <td><textarea cols="40" rows="5" name="text_1" ></textarea></td>
        <td><select name="dropdownbox1"  style="width:100;" size=4 multiple>
    <option value="<%YEAR%>">YEAR</option>
    <option value="<%MAKE%>">MAKE</option>
    <option value="<%MODEL%>">MODEL</option>
    <option value="<%VIN%>">VIN</option>
    </select>
    </td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td><input type=button value="<<Insert<<" onClick="passText(this.form.dropdownbox1.options[this.form.dropdownbox1.selectedIndex].value);" style="width:100; height:20;">
    </td>
      </tr>
    </table>
    </form> 

  2. #2
    Join Date
    Dec 2005
    Location
    FL
    Posts
    7,259

    Thumbs up This may work with slight modifications

    Take a peek at an earlier forum thread I posted that solved this for another user.
    See: http://www.webdeveloper.com/forum/sh...d.php?t=110464

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