Getting the value of checked radio button

If there are two radio buttons with same name and different values and you want to get the value of a checked radio button, we can use an indirect method. Create a field with type hidden and in the onClick event of radio buttons, write down the values to the hidden field.
function test(mvalue)
{
document.forms[0].industry.value=mvalue;
}
function show()
{
temp=document.forms[0].industry.value;
alert(temp);
}

<input type="hidden" name="industry">
<input type="radio" name="r" value="Manufacturing"
onClick="test(this.value)">
<input type="radio" name="r" value="Service"
onClick="test(this.value)">
<input type="button" name="b" onClick="show()">

Dig Deeper on Lotus Notes Domino Administration Tools

SearchWindowsServer
Search400
  • Favorite iSeries cheat sheets

    Here you'll find a collection of valuable cheat sheets gathered from across the iSeries/Search400.com community. These cheat ...

SearchDataCenter
SearchContentManagement
Close