From 21c5ffa531c0ddafd0293e2427a7e3d22afe7443 Mon Sep 17 00:00:00 2001 From: neekfenwick Date: Sun, 20 Feb 2022 20:29:01 +0700 Subject: [PATCH] Use this.name properly so widget in form behaves. (#329) --- form/Rating.js | 4 ++-- form/tests/test_Rating.html | 14 +++++++++++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/form/Rating.js b/form/Rating.js index 95953f24c0..ee1b5d0f54 100644 --- a/form/Rating.js +++ b/form/Rating.js @@ -36,12 +36,12 @@ define([ // Build the templateString. The number of stars is given by this.numStars, // which is normally an attribute to the widget node. - var radioName = 'rating-' + Math.random().toString(36).substring(2); + this.name = this.name || 'rating-' + Math.random().toString(36).substring(2); // The radio input used to display and select stars var starTpl = ''; // The hidden value node is attached as "focusNode" because tabIndex, id, etc. are getting mapped there. diff --git a/form/tests/test_Rating.html b/form/tests/test_Rating.html index 4d6debd998..a6d9ec1899 100644 --- a/form/tests/test_Rating.html +++ b/form/tests/test_Rating.html @@ -90,16 +90,24 @@

Inside a dojo form

dojo.require("dijit.form.FilteringSelect"); dojo.require("dijit.form.Button"); -
+

-
+


- + +

+ The value is: 0 + The form value is: -empty-