hello guys im new to wix and corvid coding, and the forum.
Today I made it possible to send the input which is entered to the input space to database by pressing "enter" at desktop mode by entering this code:
$w.onReady(function () {
$w("#input9").onKeyPress((event, $w) => {
if (event.key === "Enter") {
$w("#dataset1").save()
.then( () => {
$w("#text57").show("FadeIn");
});
}
});
});
now, when I open the website at my mobile phone, i want the same thing to happen (receiving the input when the website user presses "enter" - which is "go" or "done" in android keyboard.)
I tried several things like changing the (event.key === "Enter") to (event.key === 13), but can't still figure it out.
I hope I made myself clear
help will be appreciated
i dont understand anything from your answer but thanks anyway
Hello again.
From what I can see in the screenshot, you have to delete the onChange event on your input element and the submit button and add this code to your page's onReady function.
$w.onReady(function () {
$w("#input9").onChange((event, $w) => {
$w("#dataset1").save()
.then(() => {
$w("#text57").show("FadeIn");
});
});
});
Alternatively, you can use the submit button by adding an onClick event to the button and using insert to submit data to your database collection instead of save.
Good luck!
thank you for your answer, can you please exactly tell me what I should do from starting from the situation on the picture i post here
Hello.
Consider using input elements onChange event or add a submit button to your site, then add an onClick event to the button and execute your code inside onClick event code.
Good luck!