diff --git a/collect_app/src/main/java/org/odk/collect/android/logic/FormController.java b/collect_app/src/main/java/org/odk/collect/android/logic/FormController.java index 0996a0ef035..305a2ccbbea 100644 --- a/collect_app/src/main/java/org/odk/collect/android/logic/FormController.java +++ b/collect_app/src/main/java/org/odk/collect/android/logic/FormController.java @@ -511,7 +511,7 @@ public boolean saveAnswer(FormIndex index, IAnswerData data) throws JavaRosaExce public int stepToNextEvent(boolean stepIntoGroup) { if ((getEvent() == FormEntryController.EVENT_GROUP || getEvent() == FormEntryController.EVENT_REPEAT) - && indexIsInFieldList() && getQuestionPrompts().length > 0 && !stepIntoGroup) { + && indexIsInFieldList() && !isGroupEmpty() && !stepIntoGroup) { return stepOverGroup(); } else { return formEntryController.stepToNextEvent(); @@ -902,6 +902,11 @@ public FormEntryPrompt[] getQuestionPrompts() throws RuntimeException { return questions; } + private boolean isGroupEmpty() { + GroupDef group = (GroupDef) formEntryController.getModel().getForm().getChild(getFormIndex()); + return getIndicesForGroup(group).isEmpty(); + } + /** * Recursively gets all indices contained in this group and its children */