function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Michael_MantouvalosMichael_Mantouvalos 

How to submit data from component to JScontroller, when pressing anywhere outside of the text input field

Hi all,
I have some text input fields in an aura component.
i.e: 
 <lightning:input type="text" label="Name" id="text-input-id1" value="{!v.name}"/>

The idea is to submit the text on js controller when pressing anywhere outside of the input field it self. 
Something similar to this event :  onClick = "{!c.handleClick}"   ,but when pressing outside the input field. (or pressing tab to go to the next one)

Is there something i could do? I have searched everywhere with zero luck. 

 

Thank you!!

Best Answer chosen by Michael_Mantouvalos
ANUTEJANUTEJ (Salesforce Developers) 
Hi Michael,

>> https://developer.salesforce.com/docs/component-library/bundle/lightning:input/specification

I have not found any such examples as such but as per the documentation in the above link for lightning:input tag I see there is oncommit for which the description is: "The action triggered when the user finishes changing the input value. For example, pressing Enter, navigating away from the input element, clearing a search"  pressing Enter is mentioned I think you can try this.

Let me know if it helps you and close your query by marking it as solved so that it can help others in the future.  

Thanks.

All Answers

ANUTEJANUTEJ (Salesforce Developers) 
Hi Michael,

>> https://developer.salesforce.com/docs/component-library/bundle/lightning:input/specification

I have not found any such examples as such but as per the documentation in the above link for lightning:input tag I see there is oncommit for which the description is: "The action triggered when the user finishes changing the input value. For example, pressing Enter, navigating away from the input element, clearing a search"  pressing Enter is mentioned I think you can try this.

Let me know if it helps you and close your query by marking it as solved so that it can help others in the future.  

Thanks.
This was selected as the best answer
Michael_MantouvalosMichael_Mantouvalos
Thanks! It is what i need!