joe t. wrote:
> i agree on that. setValue has its purpose pretty much in the name.
> "Set" the "value" of a control. For checkboxes, "setChecked
> (bool)" (also applying to radios?) would have made a lot more sense.

Yes, it does apply to radios to. It's a shame that the docs aren't 
clear on this behavior.

You can play a little with this test page:

I personally think it would be better if setValue on radio and 
checkbox either really set the value, or set the checked state base on 

Element.setValue = function(element, newValue) {
     $(element).checked = ($(element).value == newValue);

This way, you could check or uncheck the element, especially radio, 
based on that if value is matching. This would be useful for methods 
similar to Form.unserialize();

It is of course impossible to be done at this state of the library, 
where the code is used in (hundreds of) thousands of scripts among the 

I will probably write additional method for my needs with use of the 
excellent Element.extend method.

I want to thank all the prototype.js developers, doc writers and 
supporters for your work on the library. Great job!

Best regards,

You received this message because you are subscribed to the Google Groups 
"Prototype &" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

Reply via email to