I am trying to check a checkbox based on picklist value user selected. For that I am tried below code but its working only on load. Here picklist field is Status. Picklist values are Active and Inactive. If Status is Active then checkbox Active__c should be true otherwise false.


<force:inputField  value="{!v.OppRecord.Active__c}" />


var opp = component.get("v.OppRecord");
opp.Active__c = true;
component.set('v.OppRecord', opp);

closed as unclear what you're asking by Pranay Jaiswal, glls, battery.cord, Reshma, Raul Feb 11 at 17:52

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • any particualr reason why you are not using lighning:input ? – glls Feb 11 at 15:17
  • there is no reason. I am not sure how to make Active as checked based on status field value. Small example will be appreciated. – SFDC Guest Feb 11 at 15:19
  • 2
    Please post more of your code. At the moment there's no way to tell what the root cause of the issue is without seeing more of the component markup and seeing what your Controller does. – nbrown Feb 11 at 15:20
  • 1
    Possible duplicate of lightning checkbox is not working – glls Feb 11 at 15:30
  • Right now, you are simply hard-coding the value true. You need to write the actual logic in JavaScript to populate and update the field based upon the source picklist. Give it a shot and edit your question if you can't get it to work. – David Reed Feb 11 at 17:26