Difference between revisions of "Questionnaire scripting"
(→Properties) |
(→Properties) |
||
(28 intermediate revisions by the same user not shown) | |||
Line 162: | Line 162: | ||
'''<span style="color: rgb(35, 111, 161);">• string </span>label {get; }''' - Get the question's label. | '''<span style="color: rgb(35, 111, 161);">• string </span>label {get; }''' - Get the question's label. | ||
− | '''<span style="color: | + | '''<span style="color: #236fa1;">• Questionnaire.Models.AnswerOption.models </span>'''<span class="cm-string" style="box-sizing: inherit; color: #aa1111;"></span>'''answerOptions {get; } '''- Return all answer options of the question. |
'''<span style="color: rgb(35, 111, 161);">•</span> <span style="color: rgb(35, 111, 161);">string</span> template {get; set;}''' - Get or set the question's template. | '''<span style="color: rgb(35, 111, 161);">•</span> <span style="color: rgb(35, 111, 161);">string</span> template {get; set;}''' - Get or set the question's template. | ||
Line 170: | Line 170: | ||
'''<span style="color: rgb(35, 111, 161);">•</span> <span style="color: rgb(35, 111, 161);">bool</span> answerRequired {get; }''' - Get the status of the answer's required mode. | '''<span style="color: rgb(35, 111, 161);">•</span> <span style="color: rgb(35, 111, 161);">bool</span> answerRequired {get; }''' - Get the status of the answer's required mode. | ||
− | '''<span style="color: rgb(35, 111, 161);">•</span> <span style="color: | + | '''<span style="color: rgb(35, 111, 161);">•</span> <span style="color: #236fa1;" >number </span>countdown {get; }''' - Get the number of seconds that user has to answer the question. |
− | '''<span style="color: rgb(35, 111, 161);">• </span><span style="color: rgb(35, 111, 161);"> | + | '''<span style="color: rgb(35, 111, 161);">• </span><span style="color: rgb(35, 111, 161);">number</span> points {get; }''' - Get the number of reward point that user receive after complete the question. |
'''<span style="color: rgb(35, 111, 161);">• </span><span style="color: rgb(35, 111, 161);">string</span> errorMessage {get; set}''' - Get or set the error message of question. | '''<span style="color: rgb(35, 111, 161);">• </span><span style="color: rgb(35, 111, 161);">string</span> errorMessage {get; set}''' - Get or set the error message of question. | ||
Line 178: | Line 178: | ||
'''<span style="color: #236fa1;">• </span><span style="color: #236fa1;">string</span> layout {get; }''' - Get the name of question layout. | '''<span style="color: #236fa1;">• </span><span style="color: #236fa1;">string</span> layout {get; }''' - Get the name of question layout. | ||
− | '''<span style="color: #236fa1;">• | + | '''<span style="color: #236fa1;">• </span><span style="color: #236fa1;" >number</span> type {get; }''' - Get the number of question type. |
==== style ==== | ==== style ==== | ||
TODO | TODO | ||
Line 197: | Line 197: | ||
=== <span style="color: rgb(230, 126, 35);">Properties</span> === | === <span style="color: rgb(230, 126, 35);">Properties</span> === | ||
− | '''<span style="color: rgb(35, 111, 161);">• | + | '''<span style="color: rgb(35, 111, 161);">• Questionnaire.Models.SubQuestionClosed.models</span> subQuestions {get; } '''- Return all sub questions of the question.<p>'''<span style="color: rgb(35, 111, 161);">• number</span> minimumAnswers {get; set} '''- Get or set the minimum amount of answer options that the user must choose.</p> |
− | <p>'''<span style="color: rgb(35, 111, 161);">• | + | <p>'''<span style="color: rgb(35, 111, 161);">• number</span> maximumAnswers {get; set} '''- Get or set the maximum amount of answer options that the user must choose.<br></p> |
+ | <p>'''<span style="color: #236fa1;">• array </span>defaultAnswer {set; } '''- Set default values for each sub questions. These values are separated by a semi-colon.<br></p> | ||
<p>'''<span style="color: rgb(35, 111, 161);">• string</span> resources.error.inGridAnswerRequired''' '''{get; set} '''- Get or set the error message when user miss one of the options in a grid question.</p> | <p>'''<span style="color: rgb(35, 111, 161);">• string</span> resources.error.inGridAnswerRequired''' '''{get; set} '''- Get or set the error message when user miss one of the options in a grid question.</p> | ||
− | <p>'''<span style="color: #236fa1;">• string</span> resources.error.minimumAnswersRequired''' '''{get; set} '''-Get or set the error message when user choose less than the minimum amount of answer options.</p> | + | <p>'''<span style="color: #236fa1;">• string</span> resources.error.minimumAnswersRequired''' '''{get; set} '''- Get or set the error message when user choose less than the minimum amount of answer options.</p> |
<p>'''<span style="color: rgb(35, 111, 161);">• string</span> resources.error.maximumAnswersRequired''' '''{get; set} '''- Get or set the error message when user choose more than the maximum amount of answer options.</p> | <p>'''<span style="color: rgb(35, 111, 161);">• string</span> resources.error.maximumAnswersRequired''' '''{get; set} '''- Get or set the error message when user choose more than the maximum amount of answer options.</p> | ||
Line 211: | Line 212: | ||
=== <span style="color: rgb(230, 126, 35);">Properties</span> === | === <span style="color: rgb(230, 126, 35);">Properties</span> === | ||
− | '''<span style="color: #236fa1;">• </span><span style="color: rgb(35, 111, 161);"> | + | '''<span style="color: #236fa1;">• </span><span style="color: rgb(35, 111, 161);">number</span> answerOptionRows {set; } '''- Set the number of rows of answer that display to user. |
− | '''<span style="color: #236fa1;">• </span><span style="color: | + | '''<span style="color: #236fa1;">• </span><span style="color: #236fa1;" >number</span> answerOptionColumns {set; } '''- Set the number of columns of answer that display to user. |
− | '''<span style="color: #236fa1;">• </span><span style="color: rgb(35, 111, 161);">bool </span>autoArrangeAnswerOptions''' '''{ | + | '''<span style="color: #236fa1;">• </span><span style="color: rgb(35, 111, 161);">bool </span>autoArrangeAnswerOptions''' '''{set; } '''- Set the status of the auto arrange options. |
− | '''<span style="color: | + | '''<span style="color: #236fa1;">• bool </span>openAnswerRequired {set; }''' - Set the status of the open answer's required mode (user have to write some text in the open answer). |
− | '''<span style="color: rgb(35, 111, 161);">• | + | '''<span style="color: rgb(35, 111, 161);">• </span><span style="color: #236fa1;" >number</span> minimumAnswers {get; set}''' - Get or set the minimum amount of answer options that the user must choose. |
− | ''' | + | '''<span style="color: rgb(35, 111, 161);">• </span><span style="color: #236fa1;" >number</span> maximumAnswers {get; set}''' - Get or set the maximum amount of answer options that the user must choose. |
'''<span style="color: rgb(35, 111, 161);">• string</span> resources.error.answerRequired''' '''{get; set} '''- Get or set the error message when user does not answer the question if it is required. | '''<span style="color: rgb(35, 111, 161);">• string</span> resources.error.answerRequired''' '''{get; set} '''- Get or set the error message when user does not answer the question if it is required. | ||
Line 235: | Line 236: | ||
'''<span style="color: #236fa1;">•</span> setAnswer(<span style="color: #236fa1;">object </span>element '''"answer option to set"''') '''- Set answers. | '''<span style="color: #236fa1;">•</span> setAnswer(<span style="color: #236fa1;">object </span>element '''"answer option to set"''') '''- Set answers. | ||
− | '''<span style="color: #236fa1;">•</span> toggleAnswer()''' - Set toggle property for answer options. | + | '''<span style="color: #236fa1;">•</span> toggleAnswer(<span style="color: #236fa1;" >object </span>element '''"answer option to set"''')''' - Set toggle property for answer options. |
== Number == | == Number == | ||
Line 241: | Line 242: | ||
=== <span style="color: rgb(230, 126, 35);">Properties</span><span style="color: rgb(230, 126, 35);"></span> === | === <span style="color: rgb(230, 126, 35);">Properties</span><span style="color: rgb(230, 126, 35);"></span> === | ||
− | '''<span style="color: rgb(35, 111, 161);">• bool <span style="color: rgb(0, 0, 0);">allowDecimals { | + | '''<span style="color: rgb(35, 111, 161);">• bool <span style="color: rgb(0, 0, 0);">allowDecimals {set; } </span></span>'''<span style="color: rgb(0, 0, 0);">- Set the status of allowing decimals input.</span> |
'''<span style="color: rgb(35, 111, 161);">•</span> <span style="color: rgb(35, 111, 161);">number </span>minimum {get; set}''' - Get or set the minimum value can be entered. | '''<span style="color: rgb(35, 111, 161);">•</span> <span style="color: rgb(35, 111, 161);">number </span>minimum {get; set}''' - Get or set the minimum value can be entered. | ||
Line 247: | Line 248: | ||
'''<span style="color: rgb(35, 111, 161);">•</span> <span style="color: rgb(35, 111, 161);">number </span>maximum {get; set} '''- Get or set the maximum value can be entered. | '''<span style="color: rgb(35, 111, 161);">•</span> <span style="color: rgb(35, 111, 161);">number </span>maximum {get; set} '''- Get or set the maximum value can be entered. | ||
− | '''<span style="color: #236fa1;">• </span><font color="#236fa1">string </font>unit { | + | '''<span style="color: #236fa1;">• </span><font color="#236fa1">string </font>unit {set; } '''- Set the text after the input box the user sees, usually used to nominate a unit.<p>'''• <span style="color: rgb(35, 111, 161);">string </span>resources.error.answerRequired {get; set} '''- Get or set the error message when user does not answer the question if it is required.</p> |
<p>'''• <span style="color: rgb(35, 111, 161);">string</span> resources.error.minimumValueRequired {get; set}''' - Get or set the error message when user enter less than the minimum value required.</p> | <p>'''• <span style="color: rgb(35, 111, 161);">string</span> resources.error.minimumValueRequired {get; set}''' - Get or set the error message when user enter less than the minimum value required.</p> | ||
<p>'''• <span style="color: rgb(35, 111, 161);">string</span> resources.error.maximumValueRequired {get; set} '''- Get or set the error message when user enter more than the maximum value required.</p> | <p>'''• <span style="color: rgb(35, 111, 161);">string</span> resources.error.maximumValueRequired {get; set} '''- Get or set the error message when user enter more than the maximum value required.</p> | ||
Line 262: | Line 263: | ||
=== <span style="color: #e67e23;">Properties</span> === | === <span style="color: #e67e23;">Properties</span> === | ||
− | <p>'''<span style="color: rgb(35, 111, 161);">• | + | <p>'''<span style="color: rgb(35, 111, 161);">• number </span>answerOptionRows {set; } '''- Set the number of rows of answer that display to user.</p> |
− | <p>'''<span style="color: rgb(35, 111, 161);">• | + | <p>'''<span style="color: rgb(35, 111, 161);">• number </span>answerOptionColumns {set; } '''- Set the number of columns of answer that display to user.</p> |
− | <p>'''<span style="color: rgb(35, 111, 161);">• bool</span> autoArrangeAnswerOptions { | + | <p>'''<span style="color: rgb(35, 111, 161);">• bool</span> autoArrangeAnswerOptions {set; } '''- Set the status of the auto arrange options.</p> |
− | <p>'''<span style="color: rgb(35, 111, 161);">• | + | <p>'''<span style="color: rgb(35, 111, 161);">• number </span>minimumAnswers {set; }''' - Set the minimum amount of answer options that the user must choose.</p> |
− | <p>'''<span style="color: rgb(35, 111, 161);">• | + | <p>'''<span style="color: rgb(35, 111, 161);">• number </span>maximumAnswers {set; }''' - Set the maximum amount of answer options that the user must choose.</p> |
<p>'''<span style="color: rgb(35, 111, 161);">• string</span> resources.error.answerRequired {get; set}''' - Get or set the error message when user does not answer the question if it is required.</p> | <p>'''<span style="color: rgb(35, 111, 161);">• string</span> resources.error.answerRequired {get; set}''' - Get or set the error message when user does not answer the question if it is required.</p> | ||
<p>'''<span style="color: #236fa1;">• string </span>resources.error.minimumAnswersRequired {get; set}''' -Get or set the error message when user choose less than the minimum amount of answer options.</p> | <p>'''<span style="color: #236fa1;">• string </span>resources.error.minimumAnswersRequired {get; set}''' -Get or set the error message when user choose less than the minimum amount of answer options.</p> | ||
Line 289: | Line 290: | ||
=== <span style="color: #e67e23;">Properties</span> === | === <span style="color: #e67e23;">Properties</span> === | ||
− | <span style="color: #e67e23;">'''<span style="color: #236fa1;">• | + | <span style="color: #e67e23;">'''<span style="color: #236fa1;">• Questionnaire.Models.SubQuestionScale.models <span style="color: rgb(0, 0, 0);">subQuestions {get; } </span></span>'''<span style="color: #236fa1;"><span style="color: rgb(0, 0, 0);">- Return all sub questions of the question.</span></span></span> |
<span style="color: #e67e23;"><span style="color: rgb(0, 0, 0);"></span></span><span style="color: #236fa1;"> | <span style="color: #e67e23;"><span style="color: rgb(0, 0, 0);"></span></span><span style="color: #236fa1;"> | ||
<span style="color: #e67e23;"><span style="color: #000000;"></span></span></span> | <span style="color: #e67e23;"><span style="color: #000000;"></span></span></span> | ||
Line 309: | Line 310: | ||
=== <span style="color: rgb(230, 126, 35);">Properties</span> === | === <span style="color: rgb(230, 126, 35);">Properties</span> === | ||
− | <p>'''<span style="color: rgb(35, 111, 161);">• bool <span style="color: rgb(0, 0, 0);">discrete {set; } - User interger value for the scale bar.</span></span> | + | <p>'''<span style="color: rgb(35, 111, 161);">• bool <span style="color: rgb(0, 0, 0);">discrete {set; }</span></span>'''<span style="color: rgb(35, 111, 161);"><span style="color: rgb(0, 0, 0);"> - User interger value for the scale bar.</span></span></p> |
<p>'''<span style="color: rgb(35, 111, 161);">• number </span>minimum {get; } '''- Get the minimum value on scale bar.</p> | <p>'''<span style="color: rgb(35, 111, 161);">• number </span>minimum {get; } '''- Get the minimum value on scale bar.</p> | ||
<p>'''<span style="color: rgb(35, 111, 161);">• number </span>maximum {get; }''' - Get the maximum value on scale bar.</p> | <p>'''<span style="color: rgb(35, 111, 161);">• number </span>maximum {get; }''' - Get the maximum value on scale bar.</p> | ||
Line 325: | Line 326: | ||
=== <span style="color: rgb(230, 126, 35);">Properties</span> === | === <span style="color: rgb(230, 126, 35);">Properties</span> === | ||
− | '''• <span style="color: rgb(35, 111, 161);"> | + | '''<span style="color: rgb(35, 111, 161);" >• </span><span style="color: rgb(35, 111, 161);">Questionnaire.Models.SubQuestionClosed.models</span> subQuestions {get; } -''' Return all sub questions of the question. |
− | '''<span style="color: rgb(35, 111, 161);" >• string </span>resources.error.inGridAnswerRequired {get; set}''' - Get or set the error message when user miss one of the options in a grid question. | + | '''<span style="color: rgb(35, 111, 161);">• string </span>resources.error.inGridAnswerRequired {get; set}''' - Get or set the error message when user miss one of the options in a grid question. |
=== <span style="color: rgb(230, 126, 35);">Functions</span> === | === <span style="color: rgb(230, 126, 35);">Functions</span> === | ||
Line 337: | Line 338: | ||
=== <span style="color: rgb(230, 126, 35);">Properties</span> === | === <span style="color: rgb(230, 126, 35);">Properties</span> === | ||
− | '''<span style="color: rgb(35, 111, 161);">• </span><span style="color: rgb(35, 111, 161);"> | + | '''<span style="color: rgb(35, 111, 161);">• </span><span style="color: rgb(35, 111, 161);">number</span> answerOptionRows {set; } '''- Set the number of rows of answer that display to user. |
− | '''<span style="color: rgb(35, 111, 161);">• </span><span style="color: rgb(35, 111, 161);"> | + | '''<span style="color: rgb(35, 111, 161);">• </span><span style="color: rgb(35, 111, 161);">number</span> answerOptionColumns {set; } '''- Set the number of columns of answer that display to user. |
− | '''<span style="color: rgb(35, 111, 161);"><span>• </span>bool</span> autoArrangeAnswerOptions''' '''{set; } - ''' | + | '''<span style="color: rgb(35, 111, 161);"><span>• </span>bool</span> autoArrangeAnswerOptions''' '''{set; } - '''Set the status of the auto arrange options. |
− | '''<span style="color: rgb(35, 111, 161);">• </span><span style="color: rgb(35, 111, 161);">bool</span> openAnswerRequired { | + | '''<span style="color: rgb(35, 111, 161);">• </span><span style="color: rgb(35, 111, 161);">bool</span> openAnswerRequired {set; }''' - Set the status of the open answer's required mode (user have to write some text in the open answer). |
− | '''<span style="color: rgb(35, 111, 161);">• string</span> resources.error.answerRequired {get; set} | + | '''<span style="color: rgb(35, 111, 161);">• string</span> resources.error.answerRequired {get; set} '''- Get or set the error message when user does not answer the question if it is required. |
=== <span style="color: rgb(230, 126, 35);">Functions</span> === | === <span style="color: rgb(230, 126, 35);">Functions</span> === | ||
Line 357: | Line 358: | ||
== Text Grid == | == Text Grid == | ||
− | === <span style="color: #e67e23;">Properties</span> === | + | === <span style="color: #e67e23;">Properties</span>'''<span style="color: rgb(35, 111, 161);"></span>''' === |
− | <p>'''<span style="color: rgb(35, 111, 161);">• string</span> unit {set; } '''- Set the text after the input box the user sees, usually used to nominate a unit | + | <p>'''<span style="color: rgb(35, 111, 161);">• Questionnaire.Models.SubQuestionOpen.models</span> subQuestions {get; } -''' Return all sub questions of the question.</p> |
+ | <p>'''<span style="color: #236fa1;">• string</span> unit {set; } '''- Set the text after the input box the user sees, usually used to nominate a unit</p> | ||
'''<span style="color: rgb(35, 111, 161);">• string </span>resources.error.inGridAnswerRequired {get; set}''' - Get or set the error message when user miss one of the options in a grid question. | '''<span style="color: rgb(35, 111, 161);">• string </span>resources.error.inGridAnswerRequired {get; set}''' - Get or set the error message when user miss one of the options in a grid question. | ||
Latest revision as of 04:27, 9 November 2022
Contents
- 1 Event handlers
- 2 Question API
Event handlers
It is possible to define JavaScript either in the questionnaire script section, or in each questions individual script section.
Answer sheet event handlers
Answer sheet event handlers are defined by calling the .bind()
method on the AnswerSheet
object.
Example:
AnswerSheet.bind('beforeCompleted', function(ev, answerSheet, questionnaire) { /* put code here */ });
The lifetime of the event handler if defined in the questionnaire script section is the until the viewer is closed.
Notice that the questionnaire script section is not used if the questionnaire is reached by using GotoQuestionnaire.
If the event handler is called in a question script section, the lifetime is from visiting the page with the given question until the viewer is closed. It it therefore NOT recommended to attach answer sheet event handlers in a question script section.
The following sections describe the actual events available.
BeforeCompleted
AnswerSheet.bind('beforeCompleted', function(ev, answerSheet, questionnaire) { /* put code here */ });
This is called when the respondent clicks the "close" button, or when an countdown completes on the last page, but before the validation and sending the closeAnswerSheet
command to the server.
AfterCompleted
AnswerSheet.bind('afterCompleted', function(ev, answerSheet, questionnaire) { /* put code here */ });
This is called after beforeCompleted
has completed.
BeforeMoveToNextPage
AnswerSheet.bind('beforeMoveToNextPage', function(ev, answerSheet, questionnaire) { /* put code here */ });
This is called before validation of the page before the moveToNextPage
command is sent to the server.
BeforeMoveToPreviousPage
AnswerSheet.bind('beforeMoveToPreviousPage', function(ev, answerSheet, questionnaire) { /* put code here */ });
This is called before validation of the page before the moveToPreviousPage
command is sent to the server.
BeforeMoveToFirstPage
AnswerSheet.bind('beforeMoveToFirstPage', function(ev, answerSheet, questionnaire) { /* put code here */ });
This is only used in the pre-viewer.
BeforeMoveToLastPage
AnswerSheet.bind('beforeMoveToLastPage', function(ev, answerSheet, questionnaire) { /* put code here */ });
This is only used in the pre-viewer.
BeforeShowPage
AnswerSheet.bind('beforeShowPage', function(ev, answerSheet, questionnaire) { /* put code here */ });
See #Sequence of events at new questions
AfterShowPage
AnswerSheet.bind('afterShowPage', function(ev, answerSheet, questionnaire, element) { /* put code here */ });
See #Sequence of events at new questions.
The element
contains the top-most html element of the page that holds all of the questions. This element contains each questions top html element as a child.
AfterValidateQuestion
AnswerSheet.bind('afterValidateQuestion', function(ev, question, state) { state.valid = /* put code here */; });
See #Sequence of events at goto another question.
State
is an object with 1 property .valid
, which contains the result of the .validate()
on each question. This may be updated during the call to afterValidateQuestion
to overwrite the state.
AfterCreateDataState
AnswerSheet.bind('afterCreateDataState', function(ev, data) { /* put code here */ });
See #Sequence of events at goto another question.
The data
contains the actual data that is sent to the server.
Question event handlers
Similar to the answersheet event handlers, it is also possible to specify events for each question.
Example:Question.bind('beforeShowQuestion', function(ev, question) { /* put code here*/ });
It is not possible to define these events in the questionnaire script section, only in each questions individual script section.
The lifetime of the event handler viewer proceeds to the next page.
The following sections describe the actual events available.
BeforeShowQuestion
Question.bind('beforeShowQuestion', function(ev, question) { /* put code here */ });
See #Sequence of events at new questions
AfterShowQuestion
Question.bind('afterShowQuestion', function(ev, question, element) { /* put code here */ });
See #Sequence of events at new questions.
The element
contains the top-most html element of the page that holds the question.
AfterValidateQuestion
Question.bind('afterValidateQuestion', function(ev, question, state) { state.valid = /* put code here */; });
See #Sequence of events at goto another question.
State
is an object with 1 property .valid
, which contains the result of the .validate()
. This may be updated during the call to afterValidateQuestion
to overwrite the state.
AnswerChanged
Question.bind('answerChanged', function(ev, question) { /* put code here */ });
Question.bind('answerChanged', function(ev, question, subquestion) { /* put code here */ });
Whenever the respondent (or script) change the answers to a question, this event is called.
All grid-type questions will add the subquestion
parameter on the call.
Reference other questions
It is possible to reference other questions on the same page, by using the Question Label of this other questions, example: Q1.attr('answerOptionColumns')
Sequence of events at new questions
The primary loop of updates occur when the viewer has visited the server (or is starting up) and got a new batch of questions to display
1. Got new questions to display
2. Update answer sheet state
3. Run individual question scripts
4. Execute each question beforeShowQuestion
event handlers
5. Execute beforeShowPage
event handlers
6. Render html
7. Execute each question afterShowQuestion
event handlers
8. Execute afterShowPage
event handlers
Sequence of events at goto another question
Once the viewer is asked to change page, a sequence of events occur before calling the server and getting the next questions to display.
Here shown for goto next page, but similar events happen for before,first and last.
1. Check if we can goto next page
2. Set state to Normal
3. Execute beforeMoveToNextPage
event handlers
4. For each question:
5. Execute .validate() on question
6. Execute afterValidateQuestion
answer sheet event handlers
7. Execute afterValidateQuestion
question event handlers
8. After all questions are processed, and if determined valid
9. Execute createDataState()
on each question
10. Execute afterCreateDataState
event handlers
11. Send the moveToNextQuestion
command to server with the data state
12. Trigger #Sequence of events at goto another question
Question API
Each question type has its own API.
To get an value stored on a question object use var value = question.attr('property');
.
To set an value stored on a question object use question.attr('property', newvalue);
.
Question
Properties
• string label {get; } - Get the question's label.
• Questionnaire.Models.AnswerOption.models answerOptions {get; } - Return all answer options of the question.
• string template {get; set;} - Get or set the question's template.
• string text {get; } - Get the question's text.
• bool answerRequired {get; } - Get the status of the answer's required mode.
• number countdown {get; } - Get the number of seconds that user has to answer the question.
• number points {get; } - Get the number of reward point that user receive after complete the question.
• string errorMessage {get; set} - Get or set the error message of question.
• string layout {get; } - Get the name of question layout.
• number type {get; } - Get the number of question type.
style
TODO
Functions
• resetAnswer() - Clear all old answer of the question.
• bool validate() - All questions have a validate function, that can be overwritten. It should return true, if the state of the question is valid and can be transmitted to the server. Or false if not.
• object createDataState() - Create data state for a question.
Multi Grid
Properties
• Questionnaire.Models.SubQuestionClosed.models subQuestions {get; } - Return all sub questions of the question.
• number minimumAnswers {get; set} - Get or set the minimum amount of answer options that the user must choose.
• number maximumAnswers {get; set} - Get or set the maximum amount of answer options that the user must choose.
• array defaultAnswer {set; } - Set default values for each sub questions. These values are separated by a semi-colon.
• string resources.error.inGridAnswerRequired {get; set} - Get or set the error message when user miss one of the options in a grid question.
• string resources.error.minimumAnswersRequired {get; set} - Get or set the error message when user choose less than the minimum amount of answer options.
• string resources.error.maximumAnswersRequired {get; set} - Get or set the error message when user choose more than the maximum amount of answer options.
Functions
TODO
Multi
Properties
• number answerOptionRows {set; } - Set the number of rows of answer that display to user.
• number answerOptionColumns {set; } - Set the number of columns of answer that display to user.
• bool autoArrangeAnswerOptions {set; } - Set the status of the auto arrange options.
• bool openAnswerRequired {set; } - Set the status of the open answer's required mode (user have to write some text in the open answer).
• number minimumAnswers {get; set} - Get or set the minimum amount of answer options that the user must choose.
• number maximumAnswers {get; set} - Get or set the maximum amount of answer options that the user must choose.
• string resources.error.answerRequired {get; set} - Get or set the error message when user does not answer the question if it is required.
• string resources.error.minimumAnswersRequired {get; set} - Get or set the error message when user choose less than the minimum amount of answer options.
• string resources.error.maximumAnswersRequired {get; set} - Get or set the error message when user choose more than the maximum amount of answer options.
Functions
• getAnswer() - Get answer value .
• setAnswer(object element "answer option to set") - Set answers.
• toggleAnswer(object element "answer option to set") - Set toggle property for answer options.
Number
Properties
• bool allowDecimals {set; } - Set the status of allowing decimals input.
• number minimum {get; set} - Get or set the minimum value can be entered.
• number maximum {get; set} - Get or set the maximum value can be entered.
• string unit {set; } - Set the text after the input box the user sees, usually used to nominate a unit.
• string resources.error.answerRequired {get; set} - Get or set the error message when user does not answer the question if it is required.
• string resources.error.minimumValueRequired {get; set} - Get or set the error message when user enter less than the minimum value required.
• string resources.error.maximumValueRequired {get; set} - Get or set the error message when user enter more than the maximum value required.
• string resources.error.numericValueRequired {get; set} - Get or set the error message when user enters text in a number question.
• string resources.error.numberOverflow {get; set} - Get or set the error message when user enters a number with too many digits.
• string resources.error.noDecimalValue {get; set} - Get or set the error message when user enters a decimal when a whole number is required.
Functions
TODO
Open
Properties
• number answerOptionRows {set; } - Set the number of rows of answer that display to user.
• number answerOptionColumns {set; } - Set the number of columns of answer that display to user.
• bool autoArrangeAnswerOptions {set; } - Set the status of the auto arrange options.
• number minimumAnswers {set; } - Set the minimum amount of answer options that the user must choose.
• number maximumAnswers {set; } - Set the maximum amount of answer options that the user must choose.
• string resources.error.answerRequired {get; set} - Get or set the error message when user does not answer the question if it is required.
• string resources.error.minimumAnswersRequired {get; set} -Get or set the error message when user choose less than the minimum amount of answer options.
• string resources.error.maximumAnswersRequired {get; set} - Get or set the error message when user choose more than the maximum amount of answer options.
Functions
• setAnswer(object element "answer option to set") - Set answers.
Page
Properties
TODO
Functions
TODO
Scale Grid
Properties
• Questionnaire.Models.SubQuestionScale.models subQuestions {get; } - Return all sub questions of the question.
• bool discrete {set; } - User interger value for the scale bar.
• number minimum {get; } - Get the minimum value on scale bar.
• number maximum {get; } - Get the maximum value on scale bar.
• string minimumText {get; } - Get the maximum text on scale bar.
• string maximumText {get; } - Get the maximum text on scale bar.
• number step {set; } - Set the step between numbers.
• string resources.error.inGridAnswerRequired {get; set} - Get or set the error message when user miss one of the options in a grid question.
Functions
TODO
Scale
Properties
• bool discrete {set; } - User interger value for the scale bar.
• number minimum {get; } - Get the minimum value on scale bar.
• number maximum {get; } - Get the maximum value on scale bar.
• string minimumText {get; } - Get the maximum text on scale bar.
• string maximumText {get; } - Get the maximum text on scale bar.
• number step {set; } - Set the step between numbers.
• string resources.error.answerRequired {get; set} - Get or set the error message when user does not answer the question if it is required.
Functions
TODO
Single Grid
Properties
• Questionnaire.Models.SubQuestionClosed.models subQuestions {get; } - Return all sub questions of the question.
• string resources.error.inGridAnswerRequired {get; set} - Get or set the error message when user miss one of the options in a grid question.
Functions
TODO
Single
Properties
• number answerOptionRows {set; } - Set the number of rows of answer that display to user.
• number answerOptionColumns {set; } - Set the number of columns of answer that display to user.
• bool autoArrangeAnswerOptions {set; } - Set the status of the auto arrange options.
• bool openAnswerRequired {set; } - Set the status of the open answer's required mode (user have to write some text in the open answer).
• string resources.error.answerRequired {get; set} - Get or set the error message when user does not answer the question if it is required.
Functions
• getAnswer() - Get answer value .
• setAnswer(object element "answer option to set") - Set answers.
• toggleAnswer() - Set toggle property for answer options.
Text Grid
Properties
• Questionnaire.Models.SubQuestionOpen.models subQuestions {get; } - Return all sub questions of the question.
• string unit {set; } - Set the text after the input box the user sees, usually used to nominate a unit
• string resources.error.inGridAnswerRequired {get; set} - Get or set the error message when user miss one of the options in a grid question.
• string resources.error.illegalType {get; set} - Get or set the error message when user enters invalid type.
• string resources.error.noDecimalValue {get; set} - Get or set the error message when user enters a decimal when a whole number is required.
Functions
TODO
Text
Properties
• string unit {set; } - Set the text after the input box the user sees, usually used to nominate a unit.
• string resources.error.answerRequired {get; set} - Get or set the error message when user does not answer the question if it is required.
Functions
TODO