           @
 
         _display_form_buttons: ( question_index, question ) ->
-
-            if question_index == @numberOfQuestions - 1 or (not question)
-                $( '#prev_btn' ).show()
-                $( '#submit_btn' ).show()
-
-                $( '#next_btn' ).hide()
-                # $("html").keydown (e) ->
-                #     $("#submit_btn").click()  if e.keyCode is 13
-
-            else if question_index == 0
-                $( '#prev_btn' ).hide()
-                $( '#submit_btn' ).hide()
-
-                $( '#next_btn' ).show()
-                # $("#xform_view").keydown (e) ->
-                #     $("#next_btn").click()  if e.keyCode is 13
-            else
-                $( '#prev_btn' ).show()
-                $( '#next_btn' ).show()
-
-                $( '#submit_btn' ).hide()
-                # $("#xform_view").keydown (e) ->
-                #     $("#next_btn").click()  if e.keyCode is 13
-
-            if @currentQuestionIndex == 0
+          # Last question
+          if question_index is @numberOfQuestions - 1 or not question
+              $( '#prev_btn' ).show()
+              $( '#submit_btn' ).show()
+              $( '#next_btn' ).hide()
+
+          # First question
+          else if question_index is 0
               $( '#prev_btn' ).hide()
-
-            if document.getElementById( 'detail_data_id' ) != null
-                $( '#submit_btn' ).show()
-            @
+              $( '#submit_btn' ).hide()
+              $( '#next_btn' ).show()
+
+          # All other questions
+          else
+              $( '#prev_btn' ).show()
+              $( '#next_btn' ).show()
+              $( '#submit_btn' ).hide()
+
+          # Always show submit button when editing an existing record
+          $( '#submit_btn' ).show() if document.getElementById('detail_data_id') != null
+          @
 
         passes_question_constraints: ->
             #TODO: First check constraints on the question we're on


          return answerJson[question.name]

        toggle_question: (question, isHide) ->

          if not question
            return false

          if isHide
            $('#' + question.name + '_field').hide()
          else
            $('#' + question.name + '_field').show()

          if question.type == 'group'
            for i in [0..(question.children.length-1)]
              child = question.children[i]
              @toggle_question( child, isHide )

          return true


              return

          # Hide the current question, show the next question
          @hide_question current_question
          @show_question next_question

          @currentQuestionIndex = next_index
          @_display_form_buttons( @currentQuestionIndex, next_question )

          #Start the Geopoint display if geopoint
          #_geopointDisplay()  if form_info.bind isnt `undefined` and form_info.bind.map isnt `undefined`

          @

