The secnario is simple if the user presses enter while in the password field, I would like to submit the login for for processing.
How can I detect that event from with in the specific text box.
Thanks in advance
keyCode === 13) { console. log('Enter key pressed') } }); to check if the key with key code 13 is pressed. If it is, then we know the enter key is pressed.
In plain JavaScript, you can use the EventTarget. addEventListener() method to listen for keyup event. When it occurs, check the keyCode 's value to see if an Enter key is pressed.
You don't need to worry about keyPress events in this case. TextInput
conveniently dispatches an enter event when user presses enter.
<mx:TextInput id="passwd" displayAsPassword="true" enter="submit()"/>
Script:
private function submit():void
{
var pw:String = passwd.text;
//submit the login here.
}
This is applicable for spark TextInput also.
keyDown="if (event.keyCode==Keyboard.ENTER){ userRequest.send();}"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With