[LON-CAPA-users] Calling the jsme editor from a customresponse problem

Damien Guillaume damieng at msu.edu
Thu May 5 14:42:09 EDT 2016

OK, I think I found a more reliable way to get a reference to the input 
You have to set an id attribute to textline and to the response. The id 
of the input element will be "HWVAL_" + part_id + "_" response_id "_" + 
textline_id. You can then get the input element with 
document.getElementById(id). This is still undocumented, so I cannot 
ensure that it will keep working forever.

An update to my example (still not tested!):

<script src="/adm/jsme/jsme.nocache.js"></script>
     var jsmeApplet;
     function jsmeOnLoad() {
         jsmeApplet = new JSApplet.JSME("jsme_container", "380px", "340px");
         jsmeApplet.setCallBack("update_input", update_input);
     function update_input(event) {
         var part_id = "0";
         var response_id = "custom-jsme-response";
         var textline_id = "custom-jsme-textline";
         var id = "HWVAL_" + part_id + "_" response_id "_" + textline_id;
         var input = document.getElementById(id);
         input.value = jsmeApplet.jmeFile();

<div id="jsme_container"></div>
<stringresponse id="custom-jsme-response">
   <textline id="custom-jsme-textline"/>


More information about the LON-CAPA-users mailing list