Allowing Enter Key in Input

Hi Outsystems,

I have this regex in extended properties:


"this.value=this.value.replace(/[^a-zA-Z0-9 /-?:().,'+]/g,'')"

and I want to allow the Enter key as well.

Any idea how can I accomplish this?


Pedro Santos

Hello Pedro, you can use the event on keyPressed like this. You can add an event listener waiting for the.

Or add to the events of your widget the onkeypress.

The event key code for entering is 13.

   function enterKeyPressed(event) {
      if (event.keyCode == 13) {
         console.log("Enter key is pressed");
         return true;
      } else {
         return false;

Look at this example

Kind regards,


Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.