hello please help.
so, i have created one form in repeater with multiple dropdown, with contains number from 1 -10, so i want to display the total sum of all dropdown number i have selected in the input column, instantly and then to submit the that total number in data with submit button
Your SETUP:
- You have multiple dropdowns inside a → REPEATER.
- Every of your dropdowns has the choice to select a NUMBER from (1 to 10).
Your Wished PROCESS-FLOW:
- User selects multiple dropdown-choices.
- User SUBMITS.
Your Wished RESULT → Getting the calculated total-amount of selected values.
Your SOLUTION: (assuming you are using a DATASET)…
$w.onReady(()=>{
let myValues = [];
$w('#dataset1').onReady(()=>{
$w('#repeater1').onItemReady($i, iData, index()=>{
$i('#dropdown1').onChange(()=>{console.log(e.target.id+'changed');
myValues[0] = $i('#dropdown1').value;
});
$i('#dropdown2').onChange(()=>{console.log(e.target.id+'changed');
myValues[1] = $i('#dropdown2').value;
});
$i('#dropdown3').onChange(()=>{console.log(e.target.id+'changed');
myValues[2] = $i('#dropdown3').value;
});
$i('#dropdown4').onChange(()=>{console.log(e.target.id+'changed');
myValues[3] = $i('#dropdown4').value;
});
$i('#dropdown5').onChange(()=>{console.log(e.target.id+'changed');
myValues[4] = $i('#dropdown5').value;
});
$i('#mySubmitButtonInsideRepeater').onClick(()=>{
start_Submission(myValues);
});
});
});
});
function start_Submission(values) {console.log('Values: ', values);
//simple version, here you should use a --> LOOP --> for calculation....
let total = value[0] + value[1] +value[2] + value[3] + value[4];
console.log('RESULT-TOTAL: ', total);
}