As radio buttons when compiled are labelled Radio1, Radio2, Radio3 etc etc what is the best way to get the actual value of the radio button in jscript if the values are an unknown amount?[hr][/hr]
Ok I have found some jscript that you can use. This was either written by Gerard or Abdul.
-------------------------------------------------------
function getRadioValue(name)
{
var arr = document.forms[0][name];
if (arr)
{
for (var i = 0; i < arr.length; ++i)
{
if (arr[i].checked)
return arr[i].value;
}
}
return null;
}
------------------------------------------------------------
Ok I have found some jscript that you can use. This was either written by Gerard or Abdul.
-------------------------------------------------------
function getRadioValue(name)
{
var arr = document.forms[0][name];
if (arr)
{
for (var i = 0; i < arr.length; ++i)
{
if (arr[i].checked)
return arr[i].value;
}
}
return null;
}
------------------------------------------------------------
RE: Radio Buttons value
Try this:
/** * Gets the currently selected value for a group of radio buttons with the given name. * Where name is the name of your radio control in FormMaker. */ function getRadioValue(name) { var arr = document.forms[0][name]; for (var i = 0; i < arr.length; ++i) { if (arr[i].checked) return arr[i].value; } return null; }
RE: Radio Buttons value
Replies must have been posted as I updated mine. I found your code in an existing project
Cheers
RE: Radio Buttons value