1

I am developing an app which shows multiple choice questions to the user (radio buttons).

Example:

  • There are 10 questions.
  • The user selects the 1st,3rd and 4th question, so that a total of three questions are answered.
  • The user goes back to the 2nd question which was not previously selected.

Question:

How do I keep track of the number of answered questions, whie navigating ot the previous or next question.

Can anyone help me please ?

Dinkheller
  • 4,631
  • 5
  • 39
  • 67
Sumit Kesarwani
  • 563
  • 2
  • 4
  • 22
  • Are the 10 questions on a single sheet? Otherwise you can listen to the change event of the radio buttons and add to a counter. – Dinkheller Oct 28 '14 at 14:06

2 Answers2

0

I think you should store your initial question JSON in your local data base (either websql or localStorage),in my case i used webssql,Your JSON should be structured like each question should have unique Id,then on any change to any question status,update the corresponding entry in database (websql or localStorage) also(by comparing Id),and at the end when user want to submit the answer,you will have all the question with their answer in your local database(websql or localstorage) and you can send that data to backend server.

It would also help while you navigate through the question series,you can read the corresponding question with it's status from local database.

dReAmEr
  • 6,986
  • 7
  • 36
  • 63
0

If your questions in same page you can use listener and counter.

Otherwise, I think you better sync it with database every steps. So, you can track your answered questions using database. Otherwise you have to use local Storage or cookies.

Kasun
  • 21
  • 1
  • 1
  • 4