reserved variable limitations
May 24, 2013 12:00 AM
Our client has requested that feedback be presented in a such a way that we have had to write our own feedback system. The code all works fine - until we swap the test (user) variables for the assessment (reserved) variables.
It appears that the reserved variables cannot be accessed from javascript via the normal method: adding Var to the start of the variable name. The javascript always reports that the variable does not exist. Is there a fix for this?
I had success copying one of the reserved variables to a user variable (the assessment section score) - which then allowed the user variable to exposed the contents to javascript but it appears that I cannot copy the learner response from a reserved variable to a user variable at all!
As a test I have set up a modify variable action onShow that moves (in theory) the content of the reserved variable (A2Q2V1) to a user variable (uA2Q2V1) and then I have two text boxes with onClick actions. The first text box shows the reserved variable (A2Q2V1) - and that does display the learner response. The second text box shows the user variable (uA2Q2V1) and that always displays as 0.
Is there a way to do this, or is the content of the learner response variable locked for some bizarre reason?
Discussion (3)
Problem (partly) solved.
The actions transferring the reserved variable holding the learner's responses to a user variable were corrupted and not firing at all. Manually deleting and replacing with new ones solved the issue.
I'd still like to be able to access the reserved variables directly from Javascript if anyone knows how to achieve that?
If I understood you correctly, you want to access student response in quiz questions? I just created a page with a simple multiplechoice question associated with variable Question_0001 and JS (I'm testing in console) can easily access VarQuestion_0001.value, which changes from ~~~null~~~ to one of the choices when user selects it. Does it not work the same for you?
@ssneg 50669 wrote:
If I understood you correctly, you want to access student response in quiz questions? I just created a page with a simple multiplechoice question associated with variable Question_0001 and JS (I'm testing in console) can easily access VarQuestion_0001.value, which changes from ~~~null~~~ to one of the choices when user selects it. Does it not work the same for you?
The situation is a little more complex as I need to access the learner response from a screen located post-assessment. The script loops through every possible question, if the question was asked and answered incorrectly then the Feedback content is populated with The Questions text, their responses as an unordered list, and feedback (either generalised feedback for check box questions or specific to their response if it was a radio button question).
I was using VarQuestion_0001.getValue(), but it is the VarQuestion_0001 object that is coming up as 'undefined', even though I specifically placed the variable on the feedback screen to ensure that the page was able to access that variable.
Discussions have been disabled for this post