Solved

Adding a selected value from a listbox to a form.

Posted on 2002-03-08
4
311 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
Comment Utility
    <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
Comment Utility
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
Comment Utility
I aplogise for taking so long.

Thanks

Hannes
0
 
LVL 4

Expert Comment

by:vindevogel
Comment Utility
No problem, thanks for the points
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

In this short web based tutorial, I wanted to show users how they can still use the powers of FrontPage in conjunction with Expression Web 3.  Even though Microsoft eliminated the use of Web components, we can still use them with FrontPage and edit …
This article provides a case study on how our local youth baseball league deployed a new website, including the platform selection, implementation and benefits to the league.
The purpose of this video is to demonstrate how to properly insert a Vimeo Video into a WordPress site or Blog. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp…
The purpose of this video is to demonstrate how to set up the permalinks on a WordPress Website. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Go t…

744 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now