Posts made by Itamar Tzadok

Hi Kevin,

Here is a quick and dirty solution you can try out and if it works for you we can work out the details: (that's a revised version of a previous post which I deleted)

* Create a CLOZE question.
* Add question description
* In HTML mode enter

<div>{:SHORTANSWER:=ÐhelloÐ#}<span Xonclick="myInsertChar(this.parentNode);"><img title="ins_char" alt="ins_char" src="full path of icon_ins_char.gif" border="0" hspace="0" vspace="0" /></span></div>

* Remove X
* Set the correct answer of the question
* Set the url of the ins_char image (you can copy it from the tool bar of the question editor by right click -> copy image location)
* Save
* Create DESCRIPTION question
* In HTML mode enter

<script Xlanguage="javascript">
<!--
function myInsertChar(obj) {
var textField=obj.getElementsByTagName("input")[0];
if (textField==null) {
alert("No text field was found");
} else {
Dialog("your moodle server's url/moodle/lib/editor/htmlarea/popups/dlg_ins_char.php", function(cChar) {
if(!cChar) {
return false;
}
if (document.selection) { //IE
textField.focus();
sel = document.selection.createRange();
sel.text = cChar;
} else if (textField.selectionStart || textField.selectionStart==0) { //FF
var startPos = textField.selectionStart;
var endPos = textField.selectionEnd;
textField.value = textField.value.substring(0, startPos)+cChar+textField.value.substring(endPos, textField.value.length);
}
return true;
}, null);
}
}
//-->
</script>

* Remove X
* Set the url of your moodle server.
* Save
* Add both questions to the quiz.
* Now, for this solution to work you need to have an ESSAY question in the quiz page (as I said, quick and dirty) so if you don't have one already as part of the quiz you need to create an essay question (can be empty) and add it to the quiz. It is needed so that the required js for the special character pop up window will be included in the page.
* When in the quiz click on the ins_char img to insert a special character.

Give it a try and let me know if it works or if anything in my instructions requires clarification.

Itamar smile