Is there a way to Prevent Default for only certain keys

I want to make it where if I press enter in a text box in a form it will exit it, but upon making a onKeyPress event I have realized that I don't think there is a way to prevent default for specific keys that are pressed?

Wondered if anyone knew a way before I resorted to "exploiting" with a JS injection

Not sure I understand what you mean by "prevent default".

Is the desire to have an onKeyPress event that only looks for the Enter key?

Just note that IA will be removing this ability with the Markdown component in a future version

I want the OnKeyPress to only prevent the keystroke of enter.

So on the press of enter instead of adding a newline to the text box I want it to ignore then enter keypress and focus outside the text box.

When you use the prevent default on the event it makes it where it prevents all keystrokes which makes you unable to type in the text box.

yeah, I have heard. I built a module for when that day comes, but I will continue to use markdown injections out of spite till that day.

Do you have props.deferUpdates set to true? This will make the enter button fire the update to the component rather than, having it update on each key press.

okay, I may have been a little confusing with my words. it's not a text component it's a form component with a widget of the type text so it doesn't have a defer update option.