0

I've built a form in my lightning component and it seems to be working perfectly, except for a single lightning:select field not passing thru. If I check the box in the form, it doesn't reflect that upon record creation. And I checked the debug logs and it is the only field that doesn't show..

cmp code-

                <div class="slds-col slds-size_1-of-2" >
                <div class="slds-wrap" >
                    <span class="slds-checkbox slds-checkbox_standalone">
                        <label class="slds-form-element__label" for="1035Exchange">1035 Exchange</label>
                        <lightning:input type="checkbox" aura:id="1035Exchange"  name="1035Exchange" value="{!v.newLLCRPP.X1035_Exchange__c}" />        
                    </span>   
                </div>
            </div>

helper code (remember all of these work and push properly, except the checkbox (1035 Exchange)-

        myLLCRPP.push({'sobjectType': 'Proposed_Purchase__c',
                   'Add_to_Contract__c' : newLLCRPP.Add_to_Contract__c,
                   'Product__c': newLLCRPP.Product__c,                
                   'Target_Premium__c': newLLCRPP.Target_Premium__c,
                   'Plan_Premium__c': newLLCRPP.Plan_Premium__c,
                   'Name_of_Finance_Company__c': newLLCRPP.Name_of_Finance_Company__c,
                   'Premium_Generated__c': newLLCRPP.Premium_Generated__c,
                   'Premium_Finance_Info__c': newLLCRPP.Premium_Finance_Info__c,
                   'X1035_Exchange__c': newLLCRPP.X1035_Exchange__c,
                   'Financial_Objectives__c': newLLCRPP.Financial_Objectives__c,
                  });

debug log- enter image description here

Any ideas why this is happening? I am confident the field's API name is X1035_Exchange__c

1 Answer 1

2

Refering to the documentation of lightning:input for checkbox value is stored not in the value property, but int the checked

<aura:component>
    <lightning:input type="checkbox" label="Basic option" name="input1"/>
    <lightning:input type="checkbox" label="Required option" name="input2" checked="true" required="true"/>
    <lightning:input type="checkbox" label="Disabled option" name="input3" checked="true" disabled="true"/>
</aura:component>

you will need the following code:

<lightning:input type="checkbox" aura:id="1035Exchange"  name="1035Exchange" checked="{!v.newLLCRPP.X1035_Exchange__c}" />
1
  • worked like a charm. thanks!
    – sfn00b
    Commented Sep 2, 2020 at 21:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .