Back to Table of Contents

Skip Logic, Validation and Calculation

Visible, Enabled, Locked

The Visible and Enabled settings that you check when you design a form are the initial defaults when a form is opened. They can then be modified through skip logic.

Disabled is the opposite of Enabled, if you un-check the Enabled box, we will refer to that as Disabled.

Disabled and Locked are similar but distinct properties:

  • Locked means that the user can not edit the value, but any default or calculated values will be shown (if the question is visible) stored on save.
  • Disabled, means that no data for that question will be stored, it is regarded as skipped. A disabled question also can't be edited.

Say the following:
Question1 Locked with default 'now()' would store the value generated
Question2 Disabled with default 'now()' would not store the value generated.

To the data capture user, the effect would be similar: They can't edit the question. But the data that is uploaded is different.

Note the implementation of Locked is not always perfect - check you forms to see they perform as you expect.

Skip Logic - new thinking

When you look at a paper form, it will usually say things like "If you answered No to Question 4, skip to Question 8. If you answered Yes, continue at Question 5" e.g.

  • Smoker? - Yes / No (if No, skip to Question "History of Cancer?")
  • How many? - Conditional on "Smoker?"
  • How often? - Conditional on "Smoker?"
  • Want to quit? - Conditional on "Smoker?"
  • History of Cancer?- Always required

One way we could do this in openXdata is the following:

  • For questions 5, 6 and 7 hide/disable them if the answer to question 4 is No - this may feel natural if translating from a paper form

However, it is often cleaner to do the reverse, which is not really possible with paper.

  • Start out with questions 5,6 and 7 hidden so your form looks like this
  • - Smoker?
  • - History of Cancer?
  • Then add logic so that if the answer to "Smoker?" is Yes the relevant questions appear
  • - How many?
  • - How often?
  • - Want to quit?
  • - History of Cancer?

Obviously, how you structure your form depends on your data, your users, and feedback from form testing

Adding Skip Logic

Once you have worked out how you want your form to look at the start and after the skip logic, adding the skip logic will be relatively simple.

Before you start adding skip logic:

  1. Add all your questions,
  2. Save your form and
  3. Refresh the page

This ensures that all possible values are available to the logic builder

Select how conditions will apply

Click on the all to edit

Conditions can apply

  • all - all the conditions must be met for the skip logic to occur
  • any - if any one of the following conditions occurs, the skip logic will happen
  • none - if none of the following conditions are true then the skip logic will happen
  • not all - if any of the following conditions does not occur, the skip logic will happen

 

Add conditions

Once you click < Click here to add new condition > a question will be automatically filled in for you, in the above diagram it was Options, my first question.

When you click Options (or whatever your question Text is) it will open up a box where you can get the question you're looking for. To find the question you want, delete the text that's in the box and type the first few letters of the question you're looking for - a drop down will appear with the possible questions in.

When you click is equal to you will get a dropdown that will give you different options depending on the question type. For a list:

  • is equal to
  • is not equal to
  • is in list
  • is not in list
  • is null
  • is not null

For a number or date value

  • is equal to
  • is not equal to
  • is greater than
  • is greater than or equal to
  • is less than
  • is less than or equal to
  • is null
  • is not null

For a text value

  • is equal to
  • is not equal to
  • is null
  • is not null
  • starts with
  • does not start with
  • contains
  • does not contain

Skip logic can't evaluate certain question types like Picture, Audio, Video.

When you click ______ you will either be shown a list of options in the case of a Select box (as pictured above) or a blank box with a checkbox Question value, as shown below

From this point, you can enter a number which will be a constant in your form. Or you can compare one number to another number from another question. To do the latter, check Question value and then ciick in the box and start typing to enter the name of the question

Repeat this process until you have all your conditions. Then save your form.

It is a good idea to back-up frequently when adding skip logic to a form

Delete a condition

Click on <> to delete a condition

Adding skip logic to multiple questions at once

If, as in our earlier smoking example, you have a set of questions for which the same logic applies. Click on < Click here for other questions >
to get a dialog that allows you to select multiple questions to apply the skip logic too.

Validation logic

The interface for validation logic is similar to that for Skip Logic.

Validtaion compares this questions Value or Length with another value. e.g. maybe you don't want a name longer than 10 characters - use a text question and validate with Length -> is than or equalt to -> 10

Note that the conditions that you enter are the conditions that describe a valid value, and the error message is the message that appears when a user has done something wrong and the conditions are not met.

Check out the sample form to see how to prevent a future date from being added.

Calculations

The calculat ions field allows you to enter calculations using the questions bindings as a substitiute for the value. Calculations only work on the mobile client at the moment. To run calculations on the web form use the Javascript tab.

To help with the question bindings. click on Add Field and find questions these will then be added to the calculation field for you. You do not need = at the beginning of the row, like you do in excel. You can use mathematical operators like + * - to manipulate your values.