Skip to Content (Press Enter)
OutSystems.com
Personal Edition
Community
Support
Training
Training
Online Training
Developer Schools
Boot Camps
Certifications
Tech Talks
Documentation
Documentation
Overview
ODC
O11
Forums
Forge
Get Involved
Get Involved
Jobs
Ideas
Members
Mentorship
User Groups
Platform
Platform
ODC
O11
Search in OutSystems
Log in
Get Started
Back to Forums
Gonçalo Almeida
413
Views
2
Comments
Solved
Enter key in forms and inputs
Question
Hi all,
I noticed that the platform (9.0) automaticaly adds in every input:
onkeydown="return OsEnterKey('SOMETHING', arguments[0] || window.event)"
I was wondering if there's a way to tell the platform NOT to do this or at least override this. Does somebody know how or if it's possible?
I don't want the onkeydown event beeing catched in every input.
regards
Gonçalo Almeida
Solution
Hi again,
I'm going to answer myself.
I've placed this tiny piece of JQuery in the espace Javascript:
osjs(document).ready(function() { $(":input[onkeydown]").attr('onkeydown', ''); $(window).keydown(function(event) { if(event.keyCode == 13) { if($(document.activeElement).prop("tagName").toLowerCase() == 'textarea') return true; return false; } }); });
It deletes the onkeydown in every input that has it.
Then it monitors the keypressed in the window. If it's an ENTER and the user is not in a text area, it cancels it.
If anyone has a more elegant solution, please share it.
regards
Ricardo Romero
Hello Gonçalo,
Thank you for posting your question and solution. I haven't figured out a more elegenat solution yet but if I do I will update my post.
Kind regards
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
See the full guidelines
Loading...