473,499 Members | 1,955 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do I retrieve values from combos dynamically added to html table

37 New Member
I have a table with 10 rows added by looping throw a $result from a database query. When the user selects an option from one of the combos, how do I get its value. I have used Javascript but I can only get it to work with the first combo.

COMBO CODE
Expand|Select|Wrap|Line Numbers
  1. echo"<td><select name='status[]' id='combo' onchange='getComboValue()'>";
  2.         echo"<option value='' ". (($row['finished']) == 0 ? "selected='selected'":"") . " >Fixture</option>";
  3.         echo"<option value='' ". (($row['finished']) == 1 ? "selected='selected'":"") . " >Live</option>";
  4.         echo"<option value='' ". (($row['finished']) == 2 ? "selected='selected'":"") . " >Result</option>";
  5.         echo"</select></td>";
  6.  
JAVASCRIPT
Expand|Select|Wrap|Line Numbers
  1. function getComboValue()
  2. {
  3.     var combo = document.getElementById("combo");
  4.     var selectedText = combo.options[combo.selectedIndex].text;
  5.     document.getElementById("hiddenStatus").value = selectedText;    
  6. }
  7.  
  8.  
Apr 22 '14 #1
1 1042
Rabbit
12,516 Recognized Expert Moderator MVP
You said you got it to work with the first combo. Implying that there was at least one other combo. But your code only shows one combo. And it's the combo that works. So I don't know what your question is.
Apr 22 '14 #2

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

Similar topics

3
2665
by: eSapient | last post by:
I created a web page which contains a form which contains a table. The number of rows for the table are determined dynamically. The first cell of each row contains a HyperLink control and the last...
2
2406
by: buran | last post by:
Dear ASP.NET Programmers, I have a HTML table (running as server control with the control ID: tblInsertSP). The table has 16 rows with textboxes. Depending on the value of the ddlSPType, which...
1
1680
by: Jeff H. | last post by:
I created a survey page with dynamically added html controls, as below. However, now that I have the page, is there a way to reference the fields to get the data out? while...
1
1267
by: dotnettester | last post by:
Hi, I have added some textbox dynamically and now trying to retrieve the values posted on a 'save' event. when I try the following lines I get 'Object reference not set to an instance of an...
2
910
by: dotnettester | last post by:
Hi, I added a few link buttons in a function (loadControls) that is called only on the first time the page is loaded. On the postBack I don't call this function and want to retrieve the values...
7
21466
gchq
by: gchq | last post by:
Hi there Here is the situation - a table is built dynamically with values in the cells I need to retrieve and enter into a database. I have found a way of getting values using JavaScript, but of...
0
1125
by: jburnage | last post by:
I need help in getting the values from a dynamically added user control when a user submits a form. The controls are added to a placeholder and this all works fine - but its looping through the...
5
4438
by: Nathan Sokalski | last post by:
I have a custom control that I wrote (I inherit from System.Web.UI.WebControls.CompositeControl). I dynamically add this control to my Page, but I was told that dynamically added controls do not...
1
7910
by: terminul | last post by:
Hi I have a datalist which loops through the categories and within the datalist I have a CheckBoxList which are bound on the DataList's OnItemDataBound. The only problem I have is retrieving...
0
7131
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
7007
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
7388
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5470
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4919
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
3099
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
3091
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1427
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 ...
0
297
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.