Yes/No/NA (three state)

Prev Next

Capture Yes, No and N/A responses from users using the Yes/No/NA field in the Legacy Form Builder. This field can be configured to include or exclude the N/A option. This field is great for simple "Yes" or "No" questions and allows users to quickly select a button instead of typing their response.

Scoring

You can add scoring to Yes/No/NA (three-state) selector fields using Calculation fields and a little bit of JavaScript. Assigning different weights to Yes/No/NA responses (e.g., Yes = 2, No = 1, NA = 0) can allow you to view receive total scores for surveys, inspections, safety checks, and other forms.

Note

This article assumes that you have a basic understanding of the FastField software and how to add fields, save your forms, and view them on your device.

Example

Using the following code will add all of the Yes selections in the form and display it in the computed label. If the user selects Yes, No, No, then the computed label will display 1. You can add whatever weight to the Yes selection that you would like. For example: If you select Yes, Yes, No, then the calculation (computed label) will display 4 because you've given the Yes a weight of 2instead of 1. 

var score = 0;

if ($tri_1$ == 1) {
 score += 1;
}

if($tri_2$ == 1) {
 score += 1;
}

if ($tri_3$ == 1) {
 score += 1;
}

return score;

Using the following code will add all of the Yes selections in the form and display it in the computed label. If the user selects Yes, No, No, then the computed label will display 1. You can add whatever weight to the Yes selection that you would like. For example:

var score = 0;

if ($tri_1$ == 1) {
 score += 2
}

if($tri_2$ == 1) {
 score += 2
}

if ($tri_3$ == 1) {
 score += 2
}

return score;

If you select Yes, Yes, No, then the calculation (computed label) will display 4 because you've given the Yes a weight of 2 instead of 1. 

Yes/No/NA field scoring example with JavaScript code

In the example below, we selected all Yes with a weight of 1. The total score equals 3.

Yes/No/NA field showing all Yes responses selected with total score of 3

Configuration

Setting

Description

Field Label

The label displayed for the field. This is usually displayed at the top left corner above the field.

Field Key

A Key used to reference the field in submission data. The key is also used to reference the field in rules and calculations.

Allow N/A

Inserts a N/A rating value before the Y and N values.

Default Value

The value that will be used to pre-populate the field when the form is initially opened.

Rules

A Rule or JavaScript snippet that allows you to perform actions on fields or sections within the form. The actions can include hide, show, enable, disable, showSection and hideSection. Rules are executed on field value changes and when the form is opened.

ex.
if ($field1$ > 23) { hide(); } else { show(); }

(See the Introduction to Rules article for more information.)

Required

Sets the field to have required input. You will not be able to submit the form until this field has valid input.

Enabled

If not set the field will be visible but cannot be edited or set to accept new input.

Hide Field Label

Hides the Field Label.

Hidden

If enabled the field and all labels are not visible.

Exclude From Reports

If checked, the field will be excluded from HTML and PDF reports and will also be excluded from Excel and CSV exports.

Capture Geo Location

Capture the current latitude and longitude when the acknowledgment button is clicked.

Capture Time Stamp

Capture the current date and time when the acknowledgment button is clicked.

Alert Type

Choose a theme to change the background and font colors of the field cell as displayed in the apps.

Result Data

Data Type

Domain of Values

Example JSON

Integer

1, 0, -1

{ "threestate_1": -1 }