MDL-47494 gapselect: NOBUG cannot select id with ':' in YUI3.
authorJamie Pratt <me@jamiep.org>
Thu, 6 Oct 2011 09:19:21 +0000 (16:19 +0700)
committerJamie Pratt <me@jamiep.org>
Thu, 6 Oct 2011 09:19:21 +0000 (16:19 +0700)
Moved calculation of id to a new method so that I can fetch it and pass it to
ddwtos js.

question/type/gapselect/rendererbase.php

index fae921e..49c44cf 100755 (executable)
@@ -52,7 +52,7 @@ abstract class qtype_elements_embedded_in_question_text_renderer
         $result = '';
         $result .= html_writer::tag('div', $question->format_text($questiontext,
                 $question->questiontextformat, $qa, 'question', 'questiontext', $question->id),
-                array('class' => $this->qtext_classname(), 'id' => $qa->get_qt_field_name('')));
+                array('class' => $this->qtext_classname(), 'id' => $this->qtext_id($qa)));
 
         $result .= $this->post_qtext_elements($qa, $options);
 
@@ -69,6 +69,10 @@ abstract class qtype_elements_embedded_in_question_text_renderer
         return 'qtext';
     }
 
+    protected function qtext_id($qa) {
+        return str_replace(':', '_', $qa->get_qt_field_name(''));
+    }
+
     protected abstract function embedded_element(question_attempt $qa, $place,
             question_display_options $options);