Hi Outsystems,
I have this regex in extended properties:
onkeyup:
"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?
Regards,
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.
onkeypress
function enterKeyPressed(event) { if (event.keyCode == 13) { console.log("Enter key is pressed"); return true; } else { return false; } }
Look at this example
https://www.tutorialspoint.com/enter-key-press-event-in-javascript
Kind regards,
Márcio
Hi Pedro,
1. Create a form
2. Put input field and button into it.
3. Set the "Is Form Default" to Yes.
Now when you press enter de default button will be called.
Best regards.