[LON-CAPA-users] Submission of Answer via combination of JavaScript and customresponse

Guy Albertelli II lon-capa-users@mail.lon-capa.org
Mon, 22 Jan 2007 02:02:17 -0500 (EST)


Hi Phil

> I have a couple ideas for problems mulling in my head, and I was 
> wondering if you can submit an answer or a page via JavaScript and then 
> use that submission in conjunction with a <customresponse>.

Yes you can.

You'll want to include a 
<hiddenline />
in the code.

There will then be a 

<input name="HWVAL_<responseid>" type="hidden" />


(For example
<customeresponse id="10">
  <hiddenline />
</customresponse>

will generate 
<input name="HWVAL_10" type="hidden" />

You'll need associate a value to the field before the submit occurs.

For example:

document.lonhomework.HWVAL_10.value = 'something';
document.lonhomework.submit();


Should cause 'something' to get submitted against the response.

There were some examples of this in vcu I believe.

-- 
guy@albertelli.com   0-7-1-6-27,137