Switch applets from storing state via RECORD_FORM_LABEL to using the PERSISTENCE_HASH.
#1353
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The applet state is not a "kept extra answer" which is what the
RECORD_FORM_LABELapproach is for. The applet state isn't an answer at all. It is just extra problem data that needs to persist. So exactly what thePERSISTENCE_HASHis for. In addition, webwork2 stores the kept extra answers in thelast_answercolumn which is typeTEXTand thus limited to 64KB. The data in thePERSISTENCE_HASHis stored in theproblem_datacolumn which is of typeMEDIUMTEXTand so can hold up to 16MB of data. The applet state can become larger than 64KB as is evidenced by the issue posted in the forums at https://forums.openwebwork.org/mod/forum/discuss.php?d=8785.This also removes a FIXME that has been in the code since 2010 that states that this should be done.
There is also a litle clean up of the
insertAllmethod of theAppletObjects.plmacro. It can take advantage of thetagmethod.Finally, switch ww_applet_support.js from using a submit handler to click handlers on the submit buttons. This makes applet problems work in the PG problem editor of webwork2. The PG problem editor uses click handlers on the submit buttons as well, but calls
preventDefaulton the event, and prevents the form submission from occuring. That prevents the current submit handler set in the ww_applet_support.js code from happening. Thus the answers for applets do not get submitted. By using the click handlers this gets in at the same point that the PG problem editor handlers are, and they still occur. All click handlers are executed even if one of them prevents default behavior.Note that to work correctly with problem randomization or with show me another problems, this depends on openwebwork/webwork2#2855.
The attached problem can be used to test this. That problem will not even work without this pull request because the state is to large for the
last_answercolumn.LogScale.pg.txt