D
dickson.matt
OK, I am checking the values of a radiobuttonlist with 2 values (Yes
and No) using javascript:
<table id="optMedTreatment"
onClick="SetFocusDayPhone(document.getElementsByName('optMedTreatment'))">
<tr>
<td><input id="optMedTreatment_0" type="radio" name="optMedTreatment"
value="Yes" /><label for="optMedTreatment_0">Yes</label></td>
</tr><tr>
<td><input id="optMedTreatment_1" type="radio" name="optMedTreatment"
value="No" /><label for="optMedTreatment_1">No</label></td>
</tr>
</table>
function SetFocusDayPhone(e) {
var SelectedValue="";
var i=0;
for (i=0; i<=e.length; i++)
{
if (e.checked)
{
SelectedValue=e.value;
if (SelectedValue == "No")
{
alert("Hell Yeah");
break;
};
};
};
}
I am having 2 issues:
1. When I initially come to the page and check the No option I get the
Hell Yeah message. If I initially come in and check the Yes option I
don't get the message. The problem is that if I check No, get the
message, then check Yes, I still get the message. The javascript is
firing before the value has been changed. How do I get around this?
2. I am getting a error on my page when I check the yes option, this
does not happen when I check the No option as long as it is selected
first (i.e. if the yes is selected and then the No I still get the
error). Error Message is: 'checked' is null or not an object.
and No) using javascript:
<table id="optMedTreatment"
onClick="SetFocusDayPhone(document.getElementsByName('optMedTreatment'))">
<tr>
<td><input id="optMedTreatment_0" type="radio" name="optMedTreatment"
value="Yes" /><label for="optMedTreatment_0">Yes</label></td>
</tr><tr>
<td><input id="optMedTreatment_1" type="radio" name="optMedTreatment"
value="No" /><label for="optMedTreatment_1">No</label></td>
</tr>
</table>
function SetFocusDayPhone(e) {
var SelectedValue="";
var i=0;
for (i=0; i<=e.length; i++)
{
if (e.checked)
{
SelectedValue=e.value;
if (SelectedValue == "No")
{
alert("Hell Yeah");
break;
};
};
};
}
I am having 2 issues:
1. When I initially come to the page and check the No option I get the
Hell Yeah message. If I initially come in and check the Yes option I
don't get the message. The problem is that if I check No, get the
message, then check Yes, I still get the message. The javascript is
firing before the value has been changed. How do I get around this?
2. I am getting a error on my page when I check the yes option, this
does not happen when I check the No option as long as it is selected
first (i.e. if the yes is selected and then the No I still get the
error). Error Message is: 'checked' is null or not an object.