Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use this.name properly so widget in form behaves. #329

Merged
merged 1 commit into from
Feb 20, 2022

Conversation

neekfenwick
Copy link
Contributor

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:

  • 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.

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Sep 29, 2021

CLA Signed

The committers are authorized under a signed CLA.

@dylans dylans merged commit 21c5ffa into dojo:master Feb 20, 2022
dylans pushed a commit that referenced this pull request Feb 20, 2022
dylans pushed a commit that referenced this pull request Feb 20, 2022
dylans pushed a commit that referenced this pull request Feb 20, 2022
dylans pushed a commit that referenced this pull request Feb 20, 2022
dylans pushed a commit that referenced this pull request Feb 20, 2022
dylans pushed a commit that referenced this pull request Feb 20, 2022
dylans pushed a commit that referenced this pull request Feb 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants