+ Start a Discussion
Maria Alexandra Andrica 6Maria Alexandra Andrica 6 

lightning:input

Hi,

I'm trying to insert a negative number but it does not allow me to enter a minus. 

<lightning:input min="-10.0" type="number" formatter="decimal" step = ".01" value="{!v.price}" onchange="{!c.calc}"/>
                                                                
Best Answer chosen by Maria Alexandra Andrica 6
sachinarorasfsachinarorasf
Hi Maria,

I have gone through your problem.

Go through the below code

<<<----Component------>>>>

<aura:component >
    <aura:attribute name="price" type="string" />
    <lightning:input type="number" name="input1" label="Enter a date" value="{!v.price}" onchange="{!c.calc}" min="-10.0"/>
</aura:component>

<<<----Controller---->>>

({
    calc : function(c, e, h) {
        var recordName = e.getSource().get('v.value');
        console.log('Test-->'+recordName);
    }
})


I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

Thanks and Regards,
Sachin Arora