Hello everyone,
I’m a web designer and I don’t have a lot of programming knowledge.
I created a form where people respond with values
“On a scale of 0 to 10, do you feel good? 8”
At the end of the form, I would like to add some results of the questions and show them.
Question “A + B = 9” or “C + D = 3”
and show the sum of all question results on one page
I used this code , but when a new person signs up, their score does not appear.
As far as I know, it shows in the Sandbox and not live …
Can someone help me?
data.js
export function FormularioNutra_afterQuery(item, context) {
item.Score1 = item.es1Ansiedade + item.es2Persistencia;
item.Score2 = item.al1Doce + item.al2Agua;
item.Score3 = item.sa1Cansaco + item.sa2Quedas;
item.Score4 = item.at1AtividadeSemanal + item.at2TipoDeAtividade;
item.Score5 = item.pesoAtual - item.pesoObjetivo;
item.Score6 = item.Score4 + item.Score3 + item.Score2 + item.Score1;
return item;
}
page.wix
$w.onReady(function () {
$w("#dataset1").onReady(() => {
populateCalculatedFields();
} );
$w("#dataset1").onCurrentIndexChanged( (index) => {
populateCalculatedFields();
} );
} );
function populateCalculatedFields() {
const currentItem = $w("#dataset1").getCurrentItem();
$w("#ESTotal").text = "" + currentItem.Score1;
$w("#ASTotal").text = "" + currentItem.Score2;
$w("#SGTotal").text = "" + currentItem.Score3;
$w("#ATTotal").text = "" + currentItem.Score4;
$w("#IPTotal").text = "" + currentItem.Score5;
$w("#Total").text = "" + currentItem.Score6;
}