Here is
the function for validating radiobutton list
to
select at least on Item through JavaScript
function validateRadioButtonList(radiobuttonlist_id,
msgid) {
var listItemArray =
document.getElementById(radiobuttonlist_id);
for (var i = 0;
i < listItemArray.rows.length; i++) {
var listItem =
document.getElementById(radiobuttonlist_id + "_"
+ i);
if (listItem.checked) {
isItemChecked = true;
}
}
if (isItemChecked == false)
{
document.getElementById(msgid).innerHTML = "Please
select atleast oneitem";
//document.getElementById(error_icon_star).innerHTML='<img
src="WebResource.gif" height="15px"
style="width:15px;"/>';
return false;
}
document.getElementById(msgid).innerHTML = " ";
//document.getElementById(error_icon_star).innerHTML='<b
style="color:Red">*</b>';
return true;
}
No comments:
Post a Comment