473,466 Members | 1,381 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Dynamically assign table VALUE using SELECT

127 New Member
Hi all,

I've not had much luck getting any responses from my previous posts, but managed to figure stuff out. Now I'm really stuck! Any help at all would be great....

I'd like to use a SELECT dropdown, and pass the value selected to the VALUE attribute of a table on the same page. The following is code which doesn't work!!!

[HTML]<script type="text/javascript">
function updateValue() {
document.getElementById('RETURN).value = document.getElementById('selectField').value;
}
</script>
[/HTML]-------------
[HTML]<select name="conditions_list" id="selectField" onChange="updateValue();">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
[/HTML]--------------
[HTML]<span class="style1"><span class="style5">
<span style="color: rgb(255, 0, 0);">BOX1</span><input
name="box1[]" value="RETURN" type="checkbox">
</span></span><br>
[/HTML]
Thanks!!!
Feb 9 '08 #1
5 8347
acoder
16,027 Recognized Expert Moderator MVP
document.getElementById() expects an id. You're trying to use a value instead. You've also forgotten the end quote after RETURN.
Feb 9 '08 #2
phub11
127 New Member
Thanks for the reply!

Being a total JS newbie, I tried using:

id="RETURN" in the table, and passed it to a PHP script, which reports the value as "on", not the selected value.

I also tried using document.getElementByValue... which didn't work.

Sorry about being so naive, but I've still no idea.
Feb 9 '08 #3
acoder
16,027 Recognized Expert Moderator MVP
passed it to a PHP script, which reports the value as "on", not the selected value.

I also tried using document.getElementByValue... which didn't work.
Only the checked checkboxes are passed to the PHP script. To get the values, loop over the array. document.getElementByValue doesn't exist.
Feb 9 '08 #4
phub11
127 New Member
Thanks again for the reply!

I'm a bit confused, as when this a a static table, if I select multiple cells with the same box type (i..e, box1 from random cells), but having different VALUE statements, this works fine when I print the box1 array in PHP.

I've changed this using scriptaculous to a dynamic drag-and-drop routine, so that a single template is shown above the table. This is cloned as the template is dropped into a desired cell, but I want to change the VALUE to whatever is chosen in SELECT.

I figure the above would equate to the static table I've described at the beginning (but allowing one to change VALUE). I might be going about this wrong, so could you give me a few pointers of how to do this?

Thanks!
Feb 9 '08 #5
acoder
16,027 Recognized Expert Moderator MVP
Did you add id="RETURN" to the checkbox like this:
[html]<input name="box1[]" id="RETURN" value="RETURN" type="checkbox">[/html]Remember that it also has to be checked. I assume it's checked and you're only changing the value.
Feb 11 '08 #6

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

Similar topics

4
by: Terry | last post by:
I have a number of input boxes used to display totals based on selected items for each row in a table. There are more than a few rows that are identical, except for the form field name. I have...
3
by: Kiyomi | last post by:
Hello, I create a Table1 dynamically at run time, and at the same time, I would like to create LinkButton controls, also dynamically, and insert them into each line in my Table1. I would...
0
by: Diane Yocom | last post by:
I'm very new to ASP.Net and probably jumped in a little over my head, but... I'm trying to create a user control that will control navigation through my site. It's sortof like Amazon.com, where...
2
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...
2
by: Chad | last post by:
I have a problem that I am desperate to understand. It involves dynamically adding controls to a Table control that is built as a result of performing a database query. I am not looking to...
5
by: Dennis Fazekas | last post by:
Greetings, I am creating a web form which will all the user to add an unlimited number of email addresses. Basically I have 3 buttons, "Add Another Email", "-" to remove, and a "Save" button....
2
by: jmarendo | last post by:
Hello, After reading through the "Table Basics - DOM - Refer to table cells" example at mredkj.com , I modified the code for my own purposes. In the modified version, I create a hyperlink and...
21
by: Leena P | last post by:
i want to basically take some information for the product and let the user enter the the material required to make this product 1.first page test.php which takes product code and displays...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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
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,...
0
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
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...

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.