[LON-CAPA-users] do not reset physlet on submission?

Guy Albertelli II lon-capa-users@mail.lon-capa.org
Wed, 26 Oct 2005 13:48:42 -0400 (EDT)

Hi Jay,

> Hopefully this is not OT for this list, but I have a loncapa / physlet
> question. We are using a lot of physlets inside our loncapa assignments to
> illustrate free body diagrams, animations, collisions, etc. 
> Whenever a student submits an answer the physlet gets reset to its initial
> condition. Does anyone know of a way to keep the physlet from
> reseting?

There isn't any easy way, since pressing the submit button cause the
browser to get a new page from the server which causes the browser to
start the java applet up again. In order to stop this from occuring
you would need to either
1) stop the browser from submitting and requesting a new page that the
   applet is in through either
    a) frames / iframes
    b) using javascripts XMLHTTPRequest, to rewrite the page in place

2) get the state of the physlet and send that to the server so that it
can when sending the new page out, have the page communicate to the
physlet what state it was in

1a. is the technically easiest one

1b. could be rather slick looking

2. requires support from both the hw problem to grab the state and
restore it, and from the physlet to be able to both advertise it's
state and be able to restore it.

> First positive (and easy) solution gets an Attaboy Award....

I guess I don't meet the easy requirement....

guy@albertelli.com   0-7-2-0-27,137