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

Bob Gonzales rgonzal at binghamton.edu
Fri May 6 08:36:04 EDT 2016


Thanks Damien!  We'll be giving this a try in the next week or 2 and will
likely have more questions.

On Thu, May 5, 2016 at 2:42 PM, Damien Guillaume <damieng at msu.edu> wrote:

> OK, I think I found a more reliable way to get a reference to the input
> element.
> 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>
> <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();
>     }
> </script>
>
> <div id="jsme_container"></div>
> <stringresponse id="custom-jsme-response">
>   <textline id="custom-jsme-textline"/>
> </stringresponse>
>
>
>
> Damien
> _______________________________________________
> LON-CAPA-users mailing list
> LON-CAPA-users at mail.lon-capa.org
> http://mail.lon-capa.org/mailman/listinfo/lon-capa-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.lon-capa.org/pipermail/lon-capa-users/attachments/20160506/c69904de/attachment-0001.html>


More information about the LON-CAPA-users mailing list