*
The moose likes HTML, CSS and JavaScript and the fly likes Getting the value of the select box in a textbox Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Getting the value of the select box in a textbox" Watch "Getting the value of the select box in a textbox" New topic
Author

Getting the value of the select box in a textbox

Mary Wallace
Ranch Hand

Joined: Aug 25, 2003
Posts: 138
when the user select a value from select box i need to display that in a textbox. But somehow or another the code i wrote is not working




SELECT Name="TWENTY_MONTH_DIS" onchange="xpopulate(this);"
[ October 04, 2004: Message edited by: Mary Wallace ]
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
the names are wrong!
Mary Wallace
Ranch Hand

Joined: Aug 25, 2003
Posts: 138
In my actual code its correct. When I pasted the code , i pasted name of anotehr text box
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
I ran the code with the correct name of the select and text box and it ran.

The select name is different for the example and the script that you posted.

Eric
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
this is the code that I ran:



Is that what you are doing?

Eric
Ramaswamy Srinivasan
Ranch Hand

Joined: Aug 31, 2004
Posts: 295
Hi Mary,

I have a code to get the selected value to the text box in the form.

And the code is as follows :



Is this what you were looking for? Kindly acknowledge

Cheers,
Swamy
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Getting the value of the select box in a textbox
 
Similar Threads
JavaScript Problem
javax.servlet.jsp.JspException: Failed to obtain specified collection
blur in javascript
combo and text box
converting dropdown into an editable dropdown