1

So what I am trying to do is have the user select a radio button, click next, then be taken to a different view depending on what they selected.

TestApp.app

<aura:application >
  <ltng:require scripts="{!$Resource.jquery}" afterScriptsLoaded="{!c.doInit}" />
  <aura:attribute name="radiochoice" type="Integer" default="0"/>
  <aura:attribute name="stage" type="Integer" default="0" />
  <aura:if isTrue="{!v.stage == 0}">
    <fieldset class="slds-form-element">
      <label class="slds-form-element__label" for="select-01"> </label>
      <div class="slds-form-element__control">
        <label class="slds-radio">
          <input type="radio" name="options" value="1" />
          <span class="slds-radio--faux"></span>
          <span class="slds-form-element__label">Choice 1</span>
        </label>
        <label class="slds-radio">
          <input type="radio" name="options" value="2" />
          <span class="slds-radio--faux"></span>
          <span class="slds-form-element__label">Choice 2</span>
        </label>
      </div>
    </fieldset>
    <ui:button  buttonTitle="Click to check radiobutton" class="button" label="Check" press="{!c.getInput}"/>
  </aura:if>
  <p>{!v.radiochoice}</p>
  <aura:if isTrue="{!v.stage == 1}">
    <ui:button  buttonTitle="Click to go back" class="button" label="Back" press="{!c.back}"/>
  </aura:if>
</aura:application>

TestAppController.js

({
    doInit : function(cmp, event, helper) {
    },

  getInput: function(cmp, evt) {
        console.log(document.querySelector('input[name="options"]:checked').value);
    cmp.set("v.radiochoice", $("input[name='options']:checked").val());
            cmp.set("v.stage", 1);
  },
    back : function(cmp, evt) {
        cmp.set("v.stage", 0);
    }
})

When I select a value I should be sent to the next page and shown the value of the radio button I selected. Without LockerService, it seems to work fine. Without LockerService

When I enable LockerService, it seems to always fetch whatever the first selected value was. With LockerService

2

This is definitely incorrect behavior, and would appear to be a bug in the way locker service wraps elements to protect access. I opened an internal bug W-3203877 and will try to verify in the next day.

If you can open a case, please do, and let them know the bug number.

1
  • Could this be related to the issue where binding to properties of arrays/objects gets stuck on the first value? Despite the fact that it's happening at the level of mock DOM nodes it's similar behaviour. – Charles T Jun 21 '16 at 20:32
0

This is fixed in the Spring '17 major release. Thanks for the great repro!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.