-
21 Jun 2012 11:44 AM #1
Radio#getValue() always returns true?
Radio#getValue() always returns true?
I've got several Radio buttons where I set the name so they properly act like radio buttons (only one in group can be true) but when I call getValue on radio buttons that clearly are not currently selected they always return true (e.g. they were previously selected but not now).
How can I get the boolean status of if it is currently selected or not?
-
21 Jun 2012 12:09 PM #2
Thanks for reporting this. I moved this thread to the bugs forum and pushed it to our tracking system. We will look into this.
Do you see this on all browsers or only on a specific one?
-
21 Jun 2012 1:09 PM #3
I was using Firefox when I saw this, not sure about other browsers.
-
20 Jul 2012 10:11 AM #4
Confirm
Confirm
Ran into this issue, quick fix:
field/Radio.js
Change toCode:getValue: function() { return (this._value) ? true : null; },
Code:getValue: function() { return (this._value) ? this._value : null; },
-
16 Aug 2012 6:32 AM #5
When will this be fixed? I need to select a radiobuton based on the value, but there is no way to get the value of a radiobutton if its not selected...
-
11 Oct 2012 8:56 AM #6
Consider using a ToggleGroup instead.
The Radios we include in GXT have a logical value (that is, in a Java variable). Unfortunately, browsers don't provide any event on input elements to notify us when they have become unchecked, so we have no good way of updating the logical value when the input element becomes unchecked - say, when another radio input element with the same name is checked. This is especially true when mixing GXT Radios and regular radio input elements; it's possible to "steal" checkedness from the GXT Radio.
As a result, we require that you use a construct like a ToggleGroup to ensure that the logical value and the DOM value of the Radio and input element (respectively) are kept in sync. If you add all your radios to a ToggleGroup, you should find this to no longer be an issue.
-
11 Oct 2012 9:25 AM #7
Here is the practical problem with that solution; there is no way to know/remember that this has to be done. The widget has an API that does not work and then one has to 'know/remember' that they have to apply this workaround. I find this is the case with several GXT widgets/layouts, they have special behavior that isn't knowable given the API and then it doesn't work as expected at runtime.
I don't know what the ideal solution is, if as you say, it can't be fixed. However at a minimum the Javadocs should be noted of what you just explained.
Additionally as a suggestion Sencha might create a FAQ website where workaround examples could be shown and then a link in the Javadocs to the FAQ would be most helpful.
Thanks,
-Dave
Looks like we can't reproduce the issue or there's a problem in the test case provided.


Reply With Quote