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.

i suppose in the meantime there's Element.writeAttribute
({"value":"foo"});

However, i raise caution on that because i've had inconsistent results
in the past where the DOM recognizes the attribute as changed, but the
browser did not update the visual display of the value (text inputs at
the time), and submitted the original value. It was as though the
input tag's "value" attribute and the control's value property were
different entities. The only way i found to address it was $
('element').value = "foo"; which obviously kills the elegance of
chaining methods, but seems to address both "entities", and is how
Form.Element.Serializers returns other values.

-joe t.


On Nov 10, 12:30 pm, Szymon Wilkołazki <wilkola...@gmail.com> wrote:
> Hi,
>
> I found where is the problem.
>
> I assumed, that the Form.Element.setValue method sets the value of an
> element.
>
> In case of checkboxes that is not true.
> The method changes the state of checked/unchecked instead, and leaves
> the value attribute unchanged.
>
> The example might be found here:
>
> http://tsalarioth.art.pl/~sw/setValueTest.html
>
> As you can see, if you click on the button "set value of checkbox to:
> " with empty input, the checkbox is unchecked. If the value is not
> empty, then checkbox will be checked.
>
> I do not understand why this behaviour was chosen, but I understand
> that it can't be changed now, as it would break backward compatibility.
>
> Anyway I think the setValue method needs better documentation, as it
> is now a  little bit misleading.
>
> I will open a lighthouse DOC ticket for this.
>
> Best regards,
> SWilk
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to