In Prototype.js, there’s a handy function $F to get the value of a form element.
However it doesn’t work well with a group radio buttons. The argument of $F is the id of the element, and since id is unique, we can’t use the name of the radio group to get the value, which is essentially how the server side gets the value.
<form name="myform">
<input type="radio" name="type" value="one"/>
<input type="radio" name="type" value="two"/>
<input type="radio" name="type" value="three"/>
</form>
#wrong
var typeValue = $F('type');
Here’s a quick solution.
var typeValue = Form.getInputs('myform','radio','type').find(function(radio) { return radio.checked; }).value;