0

I'm new to Salesforce and I'm trying to create a simple component.

I'm trying to get the values for the input field text and checkboxes and so far I can only get the country variable in a way I believe is not correct. The value I get for nif is undefined and the checkboxes return on instead of true or false.

This is my code:

Component markup `

<div class ="row">
    <h2 class = "Header">Enter Values</h2>
    <lightning:input aura:id="nif" name="nif" required="true" label="NIF"  value="{!v.nif}"/>
    <lightning:input id="country" name="country" required = "true" value="Portugal" label = "Country"  />
    <br/>
</div>

Create Account Lead
`

JS Constroller:

({
    handleClick : function(component, event, helper) {
        console.log(document.getElementById('country').value);

        console.log(component.find("nif").get("v.nif"));

        console.log(document.getElementById('checkbox-1').value);

        console.log(document.getElementById('checkbox-2').value);
    }
})

1 Answer 1

0

Use the Aura:Ids to get the value

for example aura:id="nif"

component.find('nif').get('v.value');
0

You must log in to answer this question.

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