473,513 Members | 2,391 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Linking ComboBox with a Text Box

4 New Member
Hi i have a very little knowledge of HTML
I am Doing my School Project and need a help.
I want to link a combobox to a textbox
say if i select a value from the combobox a particular text should appear in the text box.
EXAMPLE : The combobox has a list of Science Questions. If i select Question 1 then the answer for that question should appear in the textbox.

I donot require the answer to be fetched from any external source. It should be mentioned in the script.
Mar 26 '10 #1
3 4925
Mayur2007
67 New Member
Hello Benjamin Anthony,

Look at the below code this will help you....

<script type="text/javascript" language="javascript">
function FillTextBox(obj) {
document.getElementById("textbox1").value = obj;
}
</script>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<select name="combo1" id="combo1" onchange="FillTextBox(this.value)">
<option value="">Select Answer</option>
<option value="ans1">Answer 1</option>
<option value="ans2">Answer 2</option>
<option value="ans3">Answer 3</option>
<option value="ans4">Answer 4</option>
</select>
</td>
<td>
<input type="text" name="textbox1" id="textbox1" />
</td>
</tr>
</table>
Thanks & Regards,
Mayur Bhayani
Mar 27 '10 #2
Benjamin Anthony
4 New Member
thank you very much 90% of my job is done.
However Text box seems to be very small, i tried increasing size but it increased only horizantly. I tried to replace textbox by textarea. The textarea was created but it failed to link with the combo box. Can you please help me by replacing the text box by an textarea and giving a readonly attribute to textarea.

There would be an added advantage if you can give me the coding to retrive the data from an excel sheet. Say if i select an option from the combobox then a value from a perticular cell from an excel sheet should appear in the textarea in readonly mode.
This will help me in future, if i need to change my answer then i only have to change the value in excel sheet.
Mar 29 '10 #3
Mayur2007
67 New Member
Hello,

Check your last question on the forum I had make answer on this..

Thanks & Regards,
Mayur Bhayani.
Mar 30 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

13
2745
by: Mr. B | last post by:
Here's the situation... You've a combobox with Items already added. Say they look like this (or even lines of text): 10-00-232 10-00-256 10-01-006 10-01-213 10-02-200
3
1708
by: JAdrianB | last post by:
I'm trying to use a datagrid for data entry. I've created a couple of combo box columns using information from http://64.78.52.104/FAQ/WinForms/FAQ_c44c.asp#q480q That example basically sets...
3
1528
by: John | last post by:
Hi, I`m relitavely new to Access and have designed a small simple database for collecting information about club members (supporters club) and their subscriptions/payments.I have it all done...
11
4502
by: dskillingstad | last post by:
I've been struggling with this problem for some time and have tried multiple solutions with no luck. Let me start with, I'm a novice at Access and I'm not looking for someones help to design my...
3
3016
by: PeterZ | last post by:
G'day, After doing much searching and pinching bits of ideas from here there and everywhere I came up with a fairly 'clean' solution of including a comboBox into a dataGrid column. You can...
3
6806
by: TT (Tom Tempelaere) | last post by:
Hay there, I'm writing my own DataGridComboBoxColumn because .NET 1.1 does not have one (I hope .NET 2.0 supplies one). I based it on this article:...
5
1818
by: Brian | last post by:
I've setup a custom combobox control that allows a multikey selections. This lets the user enter key presses and the combo scrolls to the matching selection. I run into a bug when the user opens...
6
1652
by: iwdu15 | last post by:
hi, this is the code i have to put the text ina combo box thats being show into a text box Private Sub cmbteams_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)...
2
1879
by: Simon Verona | last post by:
I have a combobox that is contained within a user control. Whilst the application is running, I'm attaching the combobox to a new dataset. The problem I'm getting is that the combobox doesn't...
6
2846
by: dbuchanan | last post by:
VS2005 I've been reading all the help I can on the topic (MSDN, other) but I can't make sense of this. Desired behavior; The user is to choose from the displayed list of the databound combobox...
0
7265
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7171
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7545
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
5095
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4751
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3240
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3228
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1605
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
807
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.