Expected behaviour:
A Rating widget with a 'name' attribute in a form that is posted to the server should pass its value using that 'name' parameter.
Actual behaviour:
Rating widget with a 'name' attribute sets its radio inputs to have a rating- name, and the last one's name is then overwritten with the 'name' attribute (I presume this is a FormWidget or similar behaviour acting on focusNode). Thus not all radio inputs have the same 'name', so clicking on them doesn't trigger the normal 'change' events.
Reproduce the bug:
Have a Rating widget with a 'name' attribute such as "my-rating" and a numStars of e.g. 5.
Click the last star. All stars get highlighted and the value changes to 5.
Click the last-but-one star. It gets highlighted and the value changes.
Click the last star again. It does not get highlighted nor does the value change.
Submit the enclosing form. The value does not get sent in the expected 'my-rating' form field.
Note: The bug is not apparent on the old test_Rating.html page because it doesn't actually test the form behaviour of the Rating widget.
I've updated the widget to use this.name and respect its initial value if set, rather than always cooking up a random name and applying it to the star radio elements. I also updated the test_Rating.html page so it properly uses the form's value, and in my local env have proven that this actually posts the value in the expected form field.
See Issue #307
Expected behaviour: A Rating widget with a 'name' attribute in a form that is posted to the server should pass its value using that 'name' parameter.
Actual behaviour: Rating widget with a 'name' attribute sets its radio inputs to have a rating- name, and the last one's name is then overwritten with the 'name' attribute (I presume this is a FormWidget or similar behaviour acting on focusNode). Thus not all radio inputs have the same 'name', so clicking on them doesn't trigger the normal 'change' events.
Reproduce the bug:
Note: The bug is not apparent on the old test_Rating.html page because it doesn't actually test the form behaviour of the Rating widget.
I've updated the widget to use this.name and respect its initial value if set, rather than always cooking up a random name and applying it to the star radio elements. I also updated the test_Rating.html page so it properly uses the form's value, and in my local env have proven that this actually posts the value in the expected form field.