Providing default entries or selections for fields
Unless you specify otherwise, all fields in your form will start out blank (or, in the case of multiple-choice questions, un-selected) until a user enters or selects something. If you would like to specify a default entry or selection for a field, you have two options:
- Enter a default value in the default column. In this case, the exact number or string you enter will be used as the field's default entry or selection each time the form is filled out. Use this option when you have a single, fixed default that you would like to use.
- Enter a default expression in the calculation column. In this case, the expression you enter will be evaluated the first time the field is displayed to the user, and the result will be placed into the field as its default entry or selection; the user can then accept or update this value. Use this option when you want to default a field in some dynamic way (e.g., with a value pulled from pre-loaded data).
In the form designer, you can add either kind of default whenever you are adding or editing a field: just select the type of default you would like to add, and then enter or select the relevant details.
Whenever your default is calculated based on some expression or prior field, you should configure the field to not be relevant until everything on which its calculation depends is ready (see Implementing skip patterns with "relevance" for more on relevance). For example, say that you have a group of fields that you would like to pre-load based on an entered household ID. In that case, you would want to put those questions within a group that only becomes relevant once the household ID has been entered. Otherwise, a user beginning to fill out the survey could click on the Go To option before entering a household ID, which would list all relevant questions – including the ones that were meant to pre-load – and because those fields' calculation expressions only evaluate once (the first time they are shown to the user), they would evaluate too soon (before the household ID has been entered). If, however, the fields are not relevant until after the household ID has been entered, this problem will not arise.
If editing spreadsheet form definitions directly, the easiest way to build a calculation expression is to use the calculation-builder available as a tool in the Your forms and datasets section of the Design tab.
For details on hand-creating or hand-editing calculation expressions, see Using expressions in your forms.