Solved

Adding a selected value from a listbox to a form.

Posted on 2002-03-08
4
321 Views
Last Modified: 2013-12-23
How do I add a value that I click on in a listbox (created in HTML) to a textbox in a form (<FORM></FORM>).

The listbox is not in the <FORM></FORM> tags.

How?????

Thanks

Hannes

0
Comment
Question by:hannes1
  • 3
4 Comments
 
LVL 4

Expert Comment

by:vindevogel
ID: 6850566
    <html>
          <head>
               <script language=vbscript>
                    sub SetTextbox
                         window.document.forms(0).txtBox.value = select1.options( select1.selectedIndex ).text
                    end sub
               </script>
          </head>
         
          <body>
               <form>
                    <input type=text id=txtBox>
               </form>
               
               <SELECT size=2 id=select1 name=select1 onclick="SetTextBox">
                    <OPTION>Possibility1</OPTION>
                    <OPTION>Possibility2</OPTION>
               </SELECT>
          </body>
     </html>


This page might help you.
0
 
LVL 4

Accepted Solution

by:
vindevogel earned 20 total points
ID: 6850574
Or with Javascript, in case Webwoman sees this question, and says VBScript is for the kids.

<script language=javascript>
function SetTextbox()
{     window.document.forms(0).txtBox.value = select1.options(select1.selectedIndex).text;
}
</script>
0
 

Author Comment

by:hannes1
ID: 6855876
I aplogise for taking so long.

Thanks

Hannes
0
 
LVL 4

Expert Comment

by:vindevogel
ID: 6855906
No problem, thanks for the points
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

When setting up new project requests for our site, one of the most powerful tools our team has available to use is Axure (http://www.axure.com/). It’s a tool for creating software and web prototypes that can function and interact as if it were the a…
Objective of This Article In 1990’s, when I was a budding software professional, I had a lot of confusion about which stream or technology, I had to choose to build my career. In those days, I had lot of confusion like whether to choose System so…
The purpose of this video is to demonstrate how to make a WordPress Site faster and smaller in size by cleaning up the database. This will be demonstrated using a Windows 8 PC. Plugin WP Optimize will be used. Go to your WordPress login page. T…
The purpose of this video is to demonstrate how to reset a WordPress password if you are locked out and cannot reset the password. A typical use would be if you cannot access the email to which WordPress would send the password recovery email to…

823 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question