icon Likert Scale

The Likert Scale is a control for measuring respondents’ level of agreement with various statements on a bipolar scale.

You can use the Likert Scale control to create different types of surveys, such as customer satisfaction surveys, employee engagement surveys, overall experience surveys, etc.

This page contains a detailed description of the control properties and JavaScript samples, which you can use with this control.

Likert Scale control preview

Properties

Here you can find properties related to the Likert Scale control.

Name

A unique identifier for the control.

Name property

The Name is used in JavaScript to select a specific control, as well as for storing submissions, and in Power Automate or Zapier automations.

Important

Do not change the control’s name after the form has been in use, or you might lose saved data or break your automation.

JavaScript

The Name property allows to work with the control via JavaScript code, like this:

fd.rendered(function(){
    //can access the control using its Name:
    fd.control('LikertScale1').disabled = true;
 });

Type

Defines the type of answer input.

Type property

Select the input type from a dropdown:

  • Radio — allows a user to select only one option from the list of answers:

    Radio type

  • CheckBox — allows a user to select one or more options from the list of answers:

    CheckBox type

  • String — allows a user to write a comment for each answer option:

    String type

  • Number — allows a user to enter a number for each answer option:

    Number type

  • DropDown — allows a user to select an answer from a predefined list of options:

    DropDown type

    When you select the DropDown from the list, you will see the additional Options property.

    Add a list of options to the Options property. Each option should be on a new line, as shown here:

    Options property

Questions

Stores a list of questions.

Add a list of questions to the Questions property. Each question should be on a new line, as shown here:

Questions property

Answers

Stores a list of answers.

Add a list of answers to the Answers property. Each answer should be on a new line, as shown here:

Answers property

Width

The property defines the width of the control in pixels.

If left blank, the control takes up the entire available width in the current grid cell.

Width property

Style

Add custom CSS style to the control. This will work as a style attribute for an HTML tag.

Style property

You can apply different styles to the control. For example, the following style sets control borders and padding:

border: 4px double blue;
padding: 5px;

Class

Add a CSS class to the control, which comes in handy with CSS or even JavaScript code. This will work as a class attribute for an HTML tag.

Class property

The same class can be applied to multiple fields and controls, and then you can use CSS to modify the appearance of these. For example, we’ve used the following CSS code in the CSS editor to give controls with my-class a gray background:

.my-class {
    background: #c4c4c4;
}

JavaScript framework

In this section, you can find basic examples of how to work with the control using JavaScript.

If you are not familiar with the JavaScript framework, get started with the JavaScript basics.

Note

The control is only accessible once the form is rendered, so all calls to the control must be inside fd.rendered event:

fd.rendered(function(){
    //hide the control
    fd.control('Control1').hidden = true;
    //show the control
    fd.control('Control1').hidden = false;
});

Get or set control value

If the answer type is Radio, the control value is stored as an array of strings.

The array length is equal to the number of questions.

Get or set the value using the code:

//get answers as an array of strings
fd.control('Control1').value;

//set Radio Type Likert scale value, which has five questions
fd.control('Control1').value = ['Good', 'Okay', 'Good', 'Superb', 'Awesome'];

//set Radio Type Likert scale value, which has three questions
fd.control('Control1').value = ['Good', 'Okay', 'Awesome'];

If the answer type is CheckBox, the control value is stored as a jagged array (array of arrays).

The array length is equal to the number of questions.

Get or set the value using the code:

//get answers as an array of arrays
fd.control('Control1').value;

//set Checkbox Type Likert scale value, which has two questions
fd.control('Control1').value = [
    ['Okay', 'Cool'],
    ['Cool'],
    ['Very Poor', 'Very Cool', 'Amazing'],
    ['Superb', 'Awesome']
];

If the answer type is String, Number or DropDown, the control value is stored as a jagged array (array of arrays).

The array length is equal to the number of questions. The member arrays length is equal to the number of answer options.

Get or set the value using the code:

//get answers as an array of arrays
fd.control('Control1').value;

//set String Type Likert scale value, which has two questions and four answer options
fd.control('Control1').value = [
    ['', 'Okay', 'Cool', ''],
    ['', '', 'Cool', 'Very Cool']
];

//set Number Type Likert scale value, which has five questions and three answer options
fd.control('Control1').value = [[2, 1, 2],[0, 5, 3],[0, 1, 0],[0, 0, 6],[1, 0, 0]];

Get HTML element

Access HTML element inside the control in order to modify it, hide it, or do something else.

//access control's HTML
var htmlControl = fd.control('Control1').$el;

Hide/show control

Hide a control from a user. The control value can still be accessed and changed with JavaScript.

//hide control
fd.control('Control1').hidden = true;

//show control
fd.control('Control1').hidden = false;

Clear answers

Clear the control value.

fd.control('Control1').clear();

Handle change event

Execute a function when a control value has been changed:

fd.control('Control1').$on('change', function(value) {
    //log changes to browser's console
    console.log('New value: ' + value);
});

Disable control

Disable the control. The control value can still be changed with JavaScript and saved.

//disable control
fd.control('Control1').disabled = true;

//enable control
fd.control('Control1').disabled = false;

Change questions

Get or set questions for the Likert Scale control. The questions are stored as an array of strings.

fd.control('Control1').questions = ['How do you rate your overall experience?', 'Will you recommend us to your friends?']

Change answers

Get or set answers for the Likert Scale control. The answers are stored as an array of strings.

fd.control('Control1').answers  = ['Very Satisfied', 'Satisfied', 'Partly Satisfied', 'Not at all Satisfied']

Hide/show lines

Define whether lines between answers should be displayed or not. By default, the lines are displayed.

//hide lines
fd.control('Control1').showConnectedLines = false;

//show lines
fd.control('Control1').showConnectedLines = false;