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

Home Posts Topics Members FAQ

contactenating radio select values to one hidden field

I am trying to concatenate selected values from numerous radio button
sets into 1 series and assign it to a single hidden field. I have
never done javascript before and I continue to run into problem after
problem (object has no properties, undefined functions, etc.)

So, I am really hoping someone can end the madness for me.

Just so it's understood, the id's and names of the radio buttons vary
with a row in a table so I CANT know the name of the radio field
before hand -- I must compute it. Below is relavent code. The HTML
form is first and the the javascript. I need a {2,1,4} series returned
from combined();

Christian

http://christian.bongiorno.org
--------------------html first-----------------------
<input type="hidden" id="importance" name="importance" value="notset">
<input type="hidden" id="numReqs" name="numReqs" value="14">

<tr>
<td width="40%" class="subSectionHeader">
OM Organization and Management
</td>

<td align="left">
&nbsp;<a href="/WebESWAT_PIV/assessment/
assessmentControlCriticalityPage.do?
assessmentId=1&amp;requirementId=100"
onclick="popupAdjustCriticality(this);return false;">Adjust
Criticality</a>
</td>
<td align="center">
<!--<td BGCOLOR="#003366">-->
<INPUT TYPE=RADIO id="importance1"
NAME="importance1" VALUE="1" >1
<!--</td>-->

<!--<td BGCOLOR="#003366">-->
<INPUT TYPE=RADIO id="importance1"
NAME="importance1" VALUE="2" checked>2
<!--</td>-->

<!--<td BGCOLOR="#003366">-->
<INPUT TYPE=RADIO id="importance1"
NAME="importance1" VALUE="3" >3
<!--</td>-->

<!--<td BGCOLOR="#003366">-->

<INPUT TYPE=RADIO id="importance1"
NAME="importance1" VALUE="4" >4
<!--</td>-->

<!--<td BGCOLOR="#003366">-->
<INPUT TYPE=RADIO id="importance1"
NAME="importance1" VALUE="5" >5
<!--</td>-->

</td>
</tr>
<tr>
<td width="40%" class="subSectionHeader">
RQ PIV Requests
</td>

<td align="left">
&nbsp;<a href="/WebESWAT_PIV/assessment/
assessmentControlCriticalityPage.do?
assessmentId=1&amp;requirementId=200"
onclick="popupAdjustCriticality(this);return false;">Adjust
Criticality</a>
</td>
<td align="center">

<!--<td BGCOLOR="#003366">-->
<INPUT TYPE=RADIO id="importance2"
NAME="importance2" VALUE="1" checked>1
<!--</td>-->

<!--<td BGCOLOR="#003366">-->
<INPUT TYPE=RADIO id="importance2"
NAME="importance2" VALUE="2" >2
<!--</td>-->
<!--<td BGCOLOR="#003366">-->
<INPUT TYPE=RADIO id="importance2"
NAME="importance2" VALUE="3" >3
<!--</td>-->

<!--<td BGCOLOR="#003366">-->
<INPUT TYPE=RADIO id="importance2"
NAME="importance2" VALUE="4" >4
<!--</td>-->

<!--<td BGCOLOR="#003366">-->
<INPUT TYPE=RADIO id="importance2"
NAME="importance2" VALUE="5" >5
<!--</td>-->

</td>

</tr>
<tr>
<td width="40%" class="subSectionHeader">
IP Identity Proofing
</td>

<td align="left">
&nbsp;<a href="/WebESWAT_PIV/assessment/
assessmentControlCriticalityPage.do?
assessmentId=1&amp;requirementId=300"
onclick="popupAdjustCriticality(this);return false;">Adjust
Criticality</a>
</td>
<td align="center">
<!--<td BGCOLOR="#003366">-->
<INPUT TYPE=RADIO id="importance3"
NAME="importance3" VALUE="1" >1
<!--</td>-->

<!--<td BGCOLOR="#003366">-->
<INPUT TYPE=RADIO id="importance3"
NAME="importance3" VALUE="2" >2
<!--</td>-->

<!--<td BGCOLOR="#003366">-->
<INPUT TYPE=RADIO id="importance3"
NAME="importance3" VALUE="3" >3
<!--</td>-->

<!--<td BGCOLOR="#003366">-->

<INPUT TYPE=RADIO id="importance3"
NAME="importance3" VALUE="4" checked>4
<!--</td>-->

<!--<td BGCOLOR="#003366">-->
<INPUT TYPE=RADIO id="importance3"
NAME="importance3" VALUE="5" >5
<!--</td>-->

</td>
</tr>

---------------------------java script-------------------------
function combine() {
document.assessmentControlSelectionForm.importance .value =
concatRadios();
alert("importance value " +
document.assessmentControlSelectionForm.importance .value);
}
function concatRadios() {
var rtnValue = "";
alert("number of requirements: " +
document.assessmentControlSelectionForm.numReqs.va lue);
for( var i=0; i<
document.assessmentControlSelectionForm.numReqs.va lue; i++ ) {
var obj = document.getElementById("importance" + i);
alert("object name" + obj.name);
if(obj) {
rtnValue = rtnValue + obj.value + ",";
}
}

return rtnValue;
}

Feb 2 '07 #1
1 1682
"Sideswipe" <ch*****************@gmail.comwrote in
news:11*********************@s48g2000cws.googlegro ups.com:
for( var i=0; i<
document.assessmentControlSelectionForm.numReqs.va lue; i++ ) {
var obj = document.getElementById("importance" + i);
alert("object name" + obj.name);
if(obj) {
rtnValue = rtnValue + obj.value + ",";
}
}
You make the common assumption that you can retrieve the value of the
checked radio button with ".value" but it is not that simple. You need
to poll each radio button and see if it is checked. Like this:

for(var i=0; i<document.forms[0].importance1.length; i++){
if (document.forms[0].importance1[i].checked) {
alert('importance1 value is ' +
document.forms[0].importance1[i].value)
}
};
Feb 3 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Brian | last post by:
Hello all... I have a page that will be performing a search. The search consists of 3 radio button options. The first 2 will search the entire web through google and the site as indexed by...
1
by: David | last post by:
Hi, I have an ASP page with a form and the following code: ..... type=Radio Checked name=selectserial value=" & RS("PSL_F_Serial")..... Tis will carry over the value of RS("PSL_F_Serial"),...
10
by: DettCom | last post by:
Hello, I would like to be able to display or hide fields based on whether a specific Yes/No radio button is selected. This is in conjunction with a posting a just made here in the same group...
3
by: rob c | last post by:
Hi I'm not sure if this is the right place to ask for help on forms and radio buttons... In the following form, I'd like to set the value of 'item_name' based on which radio button was...
4
by: Pasquale | last post by:
I am using the JS and HTML code below to check that required fields are completed for attributes of a product. The first attribute is a select menu and the second is a radio set. My JS goes through...
7
by: turtle | last post by:
I want to find out the max value of a field on a report if the field is not hidden. I have formatting on the report and if the field doesn't meet a certain criteria then it is hidden. I want to...
1
by: filmfanatic | last post by:
In this emal form, I'm trying to consolidate all the input into the TEXTAREA portion and then have it emailed to a specific person. I've tried the onClick and onBlur commands but only one field's...
6
by: dba | last post by:
using the following code with a problem.... echo "<input type='hidden' name='member_id' value=\"{$row}\">{$row}"; echo "<input type='radio' name='member_name' value=\"{$row}\">{$row}<br />"; ...
5
by: satyabhaskar | last post by:
hi all, In my web page i have created radio buttons dynamically on to the page .....following is my code string Course, Semester, Section; int rowsCount; string con =...
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
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
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
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
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.