Constructor
new Answer(parent, conf)
Answer for any Question of test
Constructor for creating "Answer" objects. It supports a parameter with a configuration object with certain properties or attributes.
Parameters:
Name | Type | Description |
---|---|---|
parent |
Object | "Question" object |
conf |
Object | Configuration object (see |
- Source:
- See:
Members
checked :boolean
It keeps track marking for this Answer
Type:
- boolean
- Source:
conf :Object
Configuration Options
a Javascript object with follow structure:
{ num: 1, name: "A", charset: "utf-8", txt: "Answer 1" }
Type:
- Object
- Source:
element :Object:HTMLElement
own DOM element
Type:
- Object:HTMLElement
- Source:
name :string
clone of conf.name
Its name ('A', '1', 'a', 'IV', 'pepito', ...)
Type:
- string
- Source:
num :number
Number of this answer.
This is not equal to 'this.id' (from 0 to +Infinity)
Type:
- number
- Source:
parent :Object:Question
"Question" Parent object
Type:
- Object:Question
- Source:
root :namespace:testron
"testron" ancestor object {namespace}
Type:
- namespace:testron
- Source:
Methods
filterConf(conf)
Filter the Configuration Options
The Configuration Options will are get from parent ("Question"), if not exists
Parameters:
Name | Type | Description |
---|---|---|
conf |
Object | Configuration object |
- Source:
- See:
parseAnswer(test) → {string}
Create answers from 'answers' parameter.
The parameter can be a Javascript object or a JSON string object with follow structure:
answers: [ { name: "A", txt: "Answer 1"}, {...}, ... ]
Parameters:
Name | Type | Description |
---|---|---|
test |
Object | string | a Javascript object or a JSON string object |
- Source:
Returns:
a DEBUG string with info
- Type
- string
toHtml()
Create the HTML-UI for this Answer and return it as HTMLElement (HTMLLiElement)
- Source:
toJSON() → {string}
Parse this element to JSON
- Source:
Returns:
a JSON string which represents to this Answer object
- Type
- string