246
3.6 Navigation with Buttons and Gestures
The forms in the Blaise style sheet include a Next and Previous button to navigate though the
questionnaire. In the HTML page, these buttons are input elements with type=submit, to submit the
form. They each have a different name, so the Blaise Questionnaire engine can tell which button was
pressed, to navigate in the appropriate direction.
The mobile style sheet also includes Next and Previous buttons. However, the placement of these
buttons may vary. For example, on some devices, it is customary to put a Back or Previous button in
the upper left corner of the screen. This puts the button in the header area of the page, outside of the
form element. Additionally, many mobile users are accustomed to using gestures to navigation.
Simply swiping a figure from left to right across the screen should move to the previous page, and
swiping from right to left should move to the next page.
To make the layout more flexible, the mobile style sheet uses JavaScript to manage the form. The
Next and Previous buttons can be placed anywhere on the screen, as input element with type=button.
When they are clicked, JavaScript code manipulates the form to insert the appropriate values, so that
the Blaise questionnaire engine knows whether the Next or Previous button was clicked. This
JavaScript code is also use to process swipe events, to allow gesture-based navigation in the Blaise
questionnaire.
3.7 Animation
When navigating from page to page in a mobile app, it is customary to use animation. For example,
when going to the next page, the old page slides to the left, while the new page slides in from the
right. When moving to the previous page, the animation is displayed in the opposite direction.
Animation is an extremely powerful tool to provide visual cues to the respondent.
On a normal Blaise page, submitting a form causes a request to be sent to the server, which delivers
the next page. The browser simply replaces the previous page with the new page, with no animation.
The mobile style sheets make use of AJAX, a widely used technology that allows for asynchronous
requests. When the user submits a form (via a button click or a gesture), the JavaScript code on the
web page submits the form data, but the current page stays on the screen. When the server returns the
HTML for the next page, the browser does not replace the page, as with the normal form. Instead,
because the request was an AJAX request, the contents of the new HTML page are sent to the
JavaScript code in the old page. This code then prepares the new page, and runs an animation. This
gives the effect of the old page sliding out and the new page sliding in.
Because all of the form submission and animation are controlled by JavaScript code, more advanced
options are also possible. The direction of the animation should be right-to-left when moving forward,
and left-to-right when moving backward. Because the JavaScript code differentiates between a click
of the Next or Previous button (or a gesture), it can display the animation in the appropriate direction.
A future possibility is to improve the handling of errors. If Blaise detects an error on the page, it will
not move to the next question, but rather display the same page, with error texts on this. Ideally, this
type of transition would not use a right-to-left animation, to make it clear to the respondent that they
have not moved to the next question, because of errors on the page.
3.8 Rating Scales
Rating scales, such as a Likert scale, are a common method of measuring how respondents rate
something. For example, a 5-point scale that goes from “Completely Disagree” to “Completely
Agree” is a common answer type to measure how a respondent feels about a statement. In Blaise,
rating scales are usually implemented as a field of type List.
In Blaise IS, lists are converted to a set of options, which are usually displayed in the browser as a set
of radio buttons. Clicking one button selects it, and deselects any other button that was previously