Activity Forums Salesforce® Discussions Can we fire events on key press in Lightning for Salesforce?

  • Aman

    Member
    July 11, 2017 at 3:57 pm

    Hello shariq,

    UI components provide easy handling of user interface events such as keyboard and mouse interactions. By listening to these events, you can also bind values on UI input components using the updateon attribute, such that the values update when those events are fired.
    Capture a UI event by defining its handler on the component.

  • Parul

    Member
    September 30, 2018 at 8:33 pm

    Hello Shariq,

    Here is a lightning code sample.

    <aura:application >
        <aura:Attribute name=’val’ type = ‘String’ />
        <ui:inputText value='{!v.val}’ keyup=”{!c.search}” />
    </aura:application>
    ({
    search : function(component, event, helper) 
    {
        if(event.getParams().keyCode == 13){
            alert(‘Enter key pressed’); // Do your work here fire the event
        }
    }
    })

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos