Hi!
I have three Inputs where each is connected to a field in the same database.
After the User hits Enter the result should be: input1 + input2 = input 3.
I have managed to get this right with the code below.
Now I want to achieve the same thing in a repeater but I’m struggling to do it.
Can someone guide me in the right direction and maybe help me with the right steps?
Here is the link to the website to show you what I already achieved:
https://faszinationsportgr.editorx.io/my-site-1
Now I want to have this function in a repeater.
Thanks a lot!!
$w('#input1').onKeyPress( (event) => {
if(event.key === "Enter") {
$w('#dataset1').onReady( () => {
$w('#dataset1').setFieldValues({
"nachnameS1": $w('#input1').value,
"teamname": $w('#input1').value + "/" + $w('#input2').value
});
$w('#dataset1').save()
})
}
});
$w('#input2').onKeyPress( (event) => {
if(event.key === "Enter") {
$w('#dataset1').onReady( () => {
$w('#dataset1').setFieldValues({
"nachnameS2": $w('#input2').value,
"teamname": $w('#input1').value + "/" + $w('#input2').value
});
$w('#dataset1').save()
})
}
});
// GESAMTPUNKTE
$w('#input4').onKeyPress( (event) => {
if(event.key === "Enter") {
$w('#dataset1').onReady( () => {
$w('#dataset1').setFieldValues({
"punkteS1": $w('#input4').value,
"gesamtpunkte": Number($w('#input4').value) + Number($w('#input5').value)
});
$w('#dataset1').save()
})
}
});
$w('#input5').onKeyPress( (event) => {
if(event.key === "Enter") {
$w('#dataset1').onReady( () => {
$w('#dataset1').setFieldValues({
"punkteS2": $w('#input5').value,
"gesamtpunkte": Number($w('#input4').value) + Number($w('#input5').value)
});
$w('#dataset1').save()
})
}
});