jFormer Documentation → Advanced Fields →
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).
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.
new JFormComponentLikert(String id, String label, Array choiceArray, Array statementArray[, Array optionArray])
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.
',
)
),
));
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" }
.jFormComponentLikert
The choice array determines the values that the user can choose from.
| Key | Value |
| 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. |
The Statment array determines the questions that are asked and options specific to that question.
| Key | Value |
| 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. |
These options are common to all components.
null
HTML | a description for the component, shows underneath the component inside a DIV with the class jFormComponenpescription.
null
Array, [max(int), addButtonText(string), removeButtonText(text)] | see instanceOptions page for more information.
null
Array, [dependentOn(string), display(string), jsFunction(Javascript)[, animationOptions(array)]] | see dependencyOptions page for more information.
null
HTML | a tooltip that displays whenever the component has focus. Gives any extra help or explanation a form user might need.
null
Array | an of validations specific to the component, see the specific component for its validations.
false
Boolean | this option makes the error tip only show up on the first focus on the component if it does not pass validation.
false
Boolean | if true pressing enter while this component has focus submits the form, or advances to the next page.
null
CSS | set the style attribute for the component wrapper div.
null
String | preset the value of the component upon form loading.
Next Page: Name
This page was last edited on April 25, 2011 at 1:33pm.
1 comment (add a comment)
any way how to add two likerts to the same page?