I have a textfield. I just don’t want them to be able to create a new line.
In javascript, it seems this is simple (something like return false; or event.preventDefault(); with the onkeypress event) but I’m not sure how to work it out here…
Any ideas?
Try this one
$w.onReady(()=>{
$w("myElement").onKeyPress((event)=> {let key = event.key;
console.log("Pressed-Key: ", key);
if (key==="Enter") {console.log("ENTER was pressed!!!);}
else {console.log("ENTER was not pressed!!!);}
});
});
This isn’t what i’m looking for. But thanks.
I was already able to capture the key press event (and determine whether or not it was the enter key). What i’m not able to do is negate the effect of the enter key - i.e. prevent the addition of a new line.