I have got this lightning:inputField in my component.

<lightning:inputField aura:id="isPrimary" fieldName="SBQQ__Primary__c" value="{!v.quoteRecord.SBQQ__Primary__c}" onchange="{!c.handleCheck}"/>

With a boolean value, it never gets updated on the onchange event.

I tried to debug into it. But component.find("isPrimary").get("v.value") always return the default value. component.find("isPrimary").get("v.checked") returns undefined. I have also tried changing value into checked which doesn't work as well.

Any walkaround for this?


Just remove the value...

<lightning:inputField aura:id="isPrimary" fieldName="SBQQ__Primary__c" onchange="{!c.handleCheck}"/>

And in your Javascript ...

handleCheck: function (component, event) {
    let quoteRecord = component.get('v.quoteRecord');
    quoteRecord.SBQQ__Primary__c = component.find("isPrimary").get("v.value");
    component.set('v.quoteRecord', quoteRecord);

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.