Score calculation for a math test, upon clicking "submit".

I am making an online math test-taking website. An example, without any javascript or functional “submit” button, is available on .

The questions are stored in a database & displayed in individual repeaters (e.g. 1+7 = _). When the “submit” button outside the repeater, at the bottom of the page, is clicked, a forEachItem() loop calculates the score & saves it to the database of exam instances. The submit button takes us to the results page and, there, I access the scores from the database & present them to the user.

  1. How to ensure that “submit” button doesn’t take us to the “results” page before score calculation is complete?

  2. Will the score still be calculated if the user has JavaScript disabled?

Please also let me know if you would recommend a better approach to score calculation. Thanks in advance! :slight_smile:

Please do not open several posts with same issue, thx.

This question is different. I separated both because forums often ask us to only ask one question per post.

Here, I want to ensure that my submit button doesn’t take me to the results page before the submit_onClick() function (containing score calculation code) is completely executed.

My last post ( ) was about pages communicating between each other and your answer has been extremely helpful there.

Ok, then i would suggest to use commands like …

  1. .then(()=>{ })
  2. async + await
  3. onReady
  4. or just set the time out for a couple of time (but this one is not the best choice)
  5. setTimeout(()=>{ },3000) <---- 3sec.
1 Like

Thank you!

You are welcome, i hope it helps you.