Code not doing anything at all - Multiply input and Update collection

Hi All, I’m really hoping someone can help me please. I’ve spent most of the night scouting this forum and youtube/google for a solution.

Essentially in the below diagram changing the id in the flight-platform dropdown (my Primary key “ID” Field updates the info on the page from a data set.

What I am trying to do is have the user be able to change the “Reps” in the text box then when they press the button (Not fully sure why I made this an eyeball but it was 3AM), this multiplies the “Reps” Value by the “Coef” value and applies the result to the “Points Value”. This then should update the collection with new “Reps” & “Points” Value. For some reason when I was running the code last nigh it was updating the collection with the reps but not doing the multiplication. Now when I run the code in preview it does absolutely nothing.

import wixData from ‘wix-data’ ;

$w . onReady ( function () {

const mycollection = “liftscores” ;

const updateitem =()=>{

let reps = Number ( $w ( ‘#Coeftext’ ). text );
let coef = Number ( $w ( ‘#Repsinput’ ). value );

$w ( ‘#PointsText’ ). text = String ( reps * coef )

let toUpdate = {
“_id” : $w ( “#FPDropdown” ). value ,
“reps” : $w ( “#Repsinput” ). value

};

wixData . update ( mycollection , toUpdate )
. then (( results ) => {
console . log ( results ); //see item below
})
. catch (( err ) => {
console . log ( err );
});

}

$w ( “#SubmitButton” ). onClick ( updateitem )

}
// …

You will need to debug at each stage to see what’s happening. For example right before you call your update function, console.log(toUpdate) - is there the expected data in the object?

Maybe try testing with hard coded values first, then populate dynamically. Check your collection permissions.

It’s hard to say at the moment, so you will need to walk through your code step by step. If you are sure there is nothign amiss and believe it could be a bug, you can open and issue with customer care at wix.com/contact