Hello,
I would like to know what is wrong with my code.
I created a content manager whose content comes from members through a form
Except that in the data collected I would like 2 data (values) to multiply between it to give me a result.
And I would like this result to be saved to another text element in the content manager.
Here is my piece of code on which I get the following error:
Wix code SDK error: The text parameter that is passed to the text method cannot be set to the value 1800. It must be of type string.
import wixData from 'wix-data';
import wixUsers from 'wix-users';
function gain(){
var cote = $w("#text62");
var mise = $w("#text63");
function multiplier(){
return cote * mise;
}
return multiplier();
}
$w("#text67").text = gain()
export function dataset2 () {
$w("#text67").text = gain()
}
Cordially
Hi,
You don’t set the value.
var cote = $w ( “#text62” );
var mise = $w ( “#text63” )
Should be
var cote = $w ( “#text62” ).text;
var mise = $w ( “#text63” ).text
Kind regards,
Kristof.
I think in Javascript this should work
Otherwise use this
var cote = Number( $w ( “#text62” ).text);
var mise = Number( $w ( “#text63” ).text);
Also the function multiplier should not be in another function.
Function multiplier(value1,value2){
Var newValue = value1 * value2
Return newValue
}
Then use it as this
Multiplier(core,mise)
It’s not working sorry
https://russian-dima.wixsite.com/meinewebsite/simple-return-function
EDIT:
By the way, it is NOT RECCOMENDED to open several posts to the same topic…
https://www.wix.com/velo/forum/community-discussion/how-to-calculate-2-values-between-them