Collect: "Prev" button is enabled on first question

Created on 4 Feb 2017  路  5Comments  路  Source: getodk/collect

Software and hardware versions

Collect v1.4.14

Problem description

"Prev" button is enabled on first question.

Steps to reproduce the problem

  1. Go to Genaral Settings
  2. In User Interface - > Navigation select "User forward/backward buttons"
  3. Open any form

Expected behavior

"Prev" button should be disabled on first question.

Other information

The "Prev" button should be disabled and look like "Next" button on the last screen

good first issue help wanted user experience

All 5 comments

I want to solve this but i am confused how to check when we are on the first question. I was thinking of creating a variable that stores the question number on which we are. Is there any better approach or should i go on with this one ?

@paraschadha2052
Check FormEntryController.EVENT_BEGINNING_OF_FORM but my additional clue is that this event isn't for the first question (first question should be the first event after mentioned above event if I'm right,).

@grzesiek2010 Exactly, first question is the first event after
FormEntryController.EVENT_BEGINNING_OF_FORM. I can know the first question from this when the form initially loads but if user comes back to the first question by pressing back button from another question, i cannot keep track of that using this. Simplest approach i could think of is to create a variable to keep track of current question.

@paraschadha2052
No you have to do that without additional variable believe me it's possible. For example look here: https://github.com/opendatakit/collect/blob/master/collect_app/src/main/java/org/odk/collect/android/activities/FormEntryActivity.java#L1376 (and a few lines below). You can use the same you can always use stepToPreviousScreenEventand check if it is EVENT_BEGINNING_OF_FORM and then use stepToNextScreenEvent to go back to your current question.

Ok, i got it. Thank You @grzesiek2010 . Let me try it.

Was this page helpful?
0 / 5 - 0 ratings