J
JJA
I have "coded values" in the value attribute of my radio button group
which I can access easily. I'd like to be able to access in Javascript
the more descriptive strings I have for each radio button. Is there a
way to extend the script snippet below to access the description of
the checked radio button?
<div class="genericinputLeft">
<table>
<tr>
<td>
<input class="transradio" type="radio" name="optDataSource" value="P"
onclick="storeDataSource()" />Conventional (Purchase only)<br />
<input class="transradio" type="radio" name="optDataSource" value="R"
onclick="storeDataSource()" />Conventional (Refinance only)<br />
<input class="transradio" type="radio" name="optDataSource" value="B"
onclick="storeDataSource()" />Conventional (Purchase and Refi)<br /</td>
<td>
<input class="transradio" type="radio" name="optDataSource"
value="FP"
onclick="storeDataSource()" />FHA (Purchase only)<br />
<input class="transradio" type="radio" name="optDataSource"
value="FR"
onclick="storeDataSource()" />FHA (Refinance only)<br />
<input class="transradio" type="radio" name="optDataSource"
value="FB"
onclick="storeDataSource()" />FHA (Purchase and Refi)<br />
<input class="transradio" type="radio" name="optDataSource"
value="VA"
onclick="storeDataSource()" />VA (Purchase and Refi)<br />
<input class="transradio" type="radio" name="optDataSource"
value="FV"
onclick="storeDataSource()" />FHA and VA (Purchase and Refi)<br /</td>
<td>
<input class="transradio" type="radio" name="optDataSource"
value="HP"
onclick="storeDataSource()" />HMDA (Purchase only)<br />
<input class="transradio" type="radio" name="optDataSource"
value="HR"
onclick="storeDataSource()" />HMDA (Refinance only)<br />
<input class="transradio" type="radio" name="optDataSource"
value="HB"
onclick="storeDataSource()" />HMDA (Purchase and Refi)<br /</td>
</tr>
</table>
</div>
<script type="text/javascript">
function storeDataSource() {
var codedValue;
for (i=0;i<document.forms[0].optDataSource.length;i++) {
if (document.forms[0].optDataSource.checked) {
codedValue = document.forms[0].optDataSource.value;
// alert("the CHECKED element in the set has index value ==> " +
i + "\n" +
// "the value of the checked relative radioButton ==>
" + codedValue);
JSSetCookie("DSI", i); // store index value of which one
is CHECKED
}
}
}
which I can access easily. I'd like to be able to access in Javascript
the more descriptive strings I have for each radio button. Is there a
way to extend the script snippet below to access the description of
the checked radio button?
<div class="genericinputLeft">
<table>
<tr>
<td>
<input class="transradio" type="radio" name="optDataSource" value="P"
onclick="storeDataSource()" />Conventional (Purchase only)<br />
<input class="transradio" type="radio" name="optDataSource" value="R"
onclick="storeDataSource()" />Conventional (Refinance only)<br />
<input class="transradio" type="radio" name="optDataSource" value="B"
onclick="storeDataSource()" />Conventional (Purchase and Refi)<br /</td>
<td>
<input class="transradio" type="radio" name="optDataSource"
value="FP"
onclick="storeDataSource()" />FHA (Purchase only)<br />
<input class="transradio" type="radio" name="optDataSource"
value="FR"
onclick="storeDataSource()" />FHA (Refinance only)<br />
<input class="transradio" type="radio" name="optDataSource"
value="FB"
onclick="storeDataSource()" />FHA (Purchase and Refi)<br />
<input class="transradio" type="radio" name="optDataSource"
value="VA"
onclick="storeDataSource()" />VA (Purchase and Refi)<br />
<input class="transradio" type="radio" name="optDataSource"
value="FV"
onclick="storeDataSource()" />FHA and VA (Purchase and Refi)<br /</td>
<td>
<input class="transradio" type="radio" name="optDataSource"
value="HP"
onclick="storeDataSource()" />HMDA (Purchase only)<br />
<input class="transradio" type="radio" name="optDataSource"
value="HR"
onclick="storeDataSource()" />HMDA (Refinance only)<br />
<input class="transradio" type="radio" name="optDataSource"
value="HB"
onclick="storeDataSource()" />HMDA (Purchase and Refi)<br /</td>
</tr>
</table>
</div>
<script type="text/javascript">
function storeDataSource() {
var codedValue;
for (i=0;i<document.forms[0].optDataSource.length;i++) {
if (document.forms[0].optDataSource.checked) {
codedValue = document.forms[0].optDataSource.value;
// alert("the CHECKED element in the set has index value ==> " +
i + "\n" +
// "the value of the checked relative radioButton ==>
" + codedValue);
JSSetCookie("DSI", i); // store index value of which one
is CHECKED
}
}
}