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">
<a href="/WebESWAT_PIV/assessment/
assessmentControlCriticalityPage.do?
assessmentId=1&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">
<a href="/WebESWAT_PIV/assessment/
assessmentControlCriticalityPage.do?
assessmentId=1&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">
<a href="/WebESWAT_PIV/assessment/
assessmentControlCriticalityPage.do?
assessmentId=1&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;
}