jFormer DocumentationAdvanced Fields

Likert

JFormComponentLikert(String id, String label, Array choiceArray, Array statementArray[, Array optionArray])

The Likert field is a grouping of multiple choice options displayed in grid format. Likerts are ideal for quickly evaluating several statements with the same answer set (e.g., Strongly Disagree to Strongly Agree).

Overview

Our Likert component is an awesome component, it allows for data ranking questions that can be grouped. Each question is validated seperatly if required, and you can specify if the entire likert group is required or just specific questions.

Standard likerts have choices like Strongly Disagree - Disagree - Neither agree nor disagree - Agree - Strongly Agree

with our Likert component, you can specify any range of responses that you would like, True or false, yes or no, Sometimes/Always/Never. it is not limited to just the standard answer set.

Usage

Constructor

	
	new JFormComponentLikert(String id, String label, Array choiceArray, Array statementArray[, Array optionArray])
    

Sample Usage

create a likert with 3 general questions:

	$likert = new JFormComponentLikert('likert1', 'Please evaluate the following statements:',
            array(
                array('value' => '1', 'label' => 'Strongly Disagree', 'sublabel' => '1'),
                array('value' => '2', 'label' => 'Disagree', 'sublabel' => '2'),
                array('value' => '3', 'label' => 'Agree', 'sublabel' => '3'),
                array('value' => '4', 'label' => 'Strongly Agree', 'sublabel' => '4'),
                array('value' => '5', 'label' => 'No Opinion', 'sublabel' => '-'),
            ),
            array(
                array(
                    'name' => 'statement1',
                    'statement' => 'Question 1'
                ),
                array(
                    'name' => 'statement2',
                    'statement' => 'Question 2.',
                ),
                array(
                    'name' => 'statement3',
                    'statement' => 'Question 3.',
                    'description' => '

Or at least by a license.

', 'tip' => '

This is a likert. It likert\'s boys.

'), ), array( 'validationOptions' => array('required'), 'description' => '

Likert description.

', ) ), ));

Value Returned

Object

The object returned is based on the statement array, the keys being the name values of the statement, and then assigned their corresponding values. eg.

{statement1: "1", statement2: "4", statement3: "2" }

CSS Class

.jFormComponentLikert

Likert Choice Array

The choice array determines the values that the user can choose from.

KeyValue
value string | the value for this answer
label string | a label that goes at the top of the 'table'
sublable string | a sublabel that goes underneath this option.

Likert Statement Array

The Statment array determines the questions that are asked and options specific to that question.

KeyValue
name string | the name for this group of radio buttons for this statement.
statement string | the actual question or statement to be asked.
description string | extra details to go under the statement.
tip HTML | a tip that shows up for this statement.
validationOptions Array | you can set specific statements as required. or the entire set of questions.

Component Options

These options are common to all components.

null

description

HTML | a description for the component, shows underneath the component inside a DIV with the class jFormComponenpescription.

null

instanceOptions

Array, [max(int), addButtonText(string), removeButtonText(text)] | see instanceOptions page for more information.

null

dependencyOptions

Array, [dependentOn(string), display(string), jsFunction(Javascript)[, animationOptions(array)]] | see dependencyOptions page for more information.

null

triggerFunction

Javascript | a javascript function that runs upon component change.

null

tip

HTML | a tooltip that displays whenever the component has focus. Gives any extra help or explanation a form user might need.

null

validationOptions

Array | an of validations specific to the component, see the specific component for its validations.

false

showErrorTipOnce

Boolean | this option makes the error tip only show up on the first focus on the component if it does not pass validation.

false

enterSubmits

Boolean | if true pressing enter while this component has focus submits the form, or advances to the next page.

null

style

CSS | set the style attribute for the component wrapper div.

null

initialValue

String | preset the value of the component upon form loading.

Example

  • Demo
  • View Source

Likert Component Demo

Strongly DisagreeDisagreeAgreeStrongly AgreeNo Opinion

Or at least by a license.

Likert description.

Next Page: Name

This page was last edited on April 25, 2011 at 1:33pm.

1 comment (add a comment)

simPod on 2011-09-05 08:59:14

any way how to add two likerts to the same page?