Results 1 to 7 of 7

Thread: Radio#getValue() always returns true?

Hybrid View

Previous Post Previous Post   Next Post Next Post
    Looks like we can't reproduce the issue or there's a problem in the test case provided.
  1. #1
    Ext GWT Premium Member
    Join Date
    Jan 2009
    Location
    Franktown, CO
    Posts
    440
    Vote Rating
    6
      0  

    Default 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?

  2. #2
    Sencha Premium Member
    Join Date
    Sep 2007
    Posts
    13,976
    Vote Rating
    132
      0  

    Default

    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?

  3. #3
    Ext GWT Premium Member
    Join Date
    Jan 2009
    Location
    Franktown, CO
    Posts
    440
    Vote Rating
    6
      0  

    Default

    I was using Firefox when I saw this, not sure about other browsers.

  4. #4
    Sencha User
    Join Date
    Aug 2007
    Posts
    23
    Vote Rating
    2
      0  

    Default Confirm

    Ran into this issue, quick fix:

    field/Radio.js

    Code:
        getValue: function() {
            return (this._value) ? true : null;
        },
    Change to

    Code:
        getValue: function() {
            return (this._value) ? this._value : null;
        },

  5. #5
    Sencha User
    Join Date
    Mar 2012
    Posts
    9
    Vote Rating
    0
      0  

    Default

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

  6. #6
    Sencha User WesleyMoy's Avatar
    Join Date
    Oct 2009
    Location
    Redwood City, California
    Posts
    402
    Vote Rating
    2
      0  

    Default

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •