Thanks for the quick reply!
Yes, my bad, sorry. But it still doesn't work. Here is the code I finally got:
Code: |
getRadioViewHtml: function (readOnly) {
var id = this.getId(),
answers = '',
containerTemplate = '<div id="#{containerId}" class="aq-singlequestion">#{answers}<br class="aq-clear" /></div>',
itemTemplate =
'<div class="aq-answer-container">\
<div class="aq-answer-label"><label for="sa#{questionId}_#{hidQueId}">#{choice} #{num}</label> <input type="radio" class="aq-singlequestion-ctrl" id="sa#{questionId}_#{hidQueId}" name="#{ctrlId}" value="#{hidQueId}" #{checked} #{readonly} /></div>\
<div class="aq-answer #{selectedClass}" onclick="YAHOO.util.Dom.getElementsByClassName(\'aq-answer\',null,\'#{containerId}\',function(el){el.removeClass(\'aq-answer-selected\')});YAHOO.util.Dom.addClass(this,\'aq-answer-selected\');YAHOO.util.Dom.get(\'sa#{questionId}_#{hidQueId}\').checked=true;">#{answer}' + (this.postfix ? ' <span class="aq-singlequestion-postfix">' + this.postfix + '</span>' : '') + '</div>\
<br class="aq-clear" />\
</div>';
var containerId = this.getContainerId();
if (this.questionData) {
for (var i = 0, cnt = this.questionData.length; i < cnt; i++) {
var dataItem = this.questionData[i],
checked = dataItem['selected'] || false;
answers += AS.core.format(itemTemplate, {
hidQueId: dataItem.hidQueId,
ctrlId: id,
questionId: this.questionId,
answer: dataItem['tbxAnswer'],
choice: LM.getMessage('COM_ARIQUIZ_CHOICE'),
num: AQ.questions.util.getAnswerNumber(i + 1, this.answersOrderType),
checked: checked ? ' checked="checked"' : '',
selectedClass: checked ? 'aq-answer-selected' : '',
readonly: readOnly ? ' disabled="disabled"' : '',
containerId: containerId
})
}
};
return AS.core.format(containerTemplate, {
"containerId": containerId,
"answers": answers
});
},
|
Where am I wrong?
Thank you for your time and patience.