Input onKeyPress Function Working Only After Clicking Away

Not really sure what exactly is going wrong for you, but perhaps the input field is not yet ready to be used by the dataset. You can try a small timeout:

$w("#input8").onKeyPress((event, $w) => {
   console.log("keypress: " + event.key);
   setTimeout(() => {
      if (event.key === "Enter") {
      $w("#dataset2").save()
         .then(() => {
            $w("#text37").show("FadeIn");
          });
      }
   }, 10);
});

I’m really not sure if this will help. Might be worth trying while I shift the brain into high gear and see if I can figure out anything else.

To check if the onKeyPress() event handler is being called or not, I added a console.log() statement.

Yisrael