E-mail List Archives

Dynamic Form Content Using JavaScript

for

From: Moore, Michael
Date: Dec 18, 2006 3:40PM


I am attempting to accomplish the following.

Without access to server side scripting I would like to do the
following:

Score the answers to an online quiz.
Provide user feedback to which answers were incorrect.

At present we are using JavaScript to change the status of checkboxes
that precede each multiple choice question. The questions and the
checkbox are contained within the legend of a field set that contains
all of the answer choices. This method although clunky does work within
the limitations of checkbox reporting in JAWS. (We are using version
6.1)

The overall assessment results are summarized in edit boxes at the end
of the form. This is working well.

I attempted to eliminate the checkboxes by using dom scripting to change
the value of the class attribute for the question within the legend.

if (form.one[1].checked) {
counter += 1; //this is used to total the correct
answers

mfsct.remove(document.getElementById('chk1'),'noError');//clear out old
possible values
mfsct.remove(document.getElementById('chk1'), 'Error');

mfsct.add(document.getElementById('chk1'),'noError');//set the correct
value
}
else if (!form.one[1].checked){
mfsct.remove(document.getElementById('chk1'),'noError');
mfsct.remove(document.getElementById('chk1'), 'Error');
mfsct.add(document.getElementById('chk1'),'Error');
}

The styles associated with the Error and noError classes set the color
of the text and either hide or display text indicating an error using
the display property. display:inline or display:none;

JAWS correctly reads the questions when the user is not in forms mode.
However, when in forms mode JAWS always reads the error message,
resulting in a very confusing result. (All answers are wrong.)

Does anyone have a better solution?

Sorry I cannot provide a link to a demonstration page, I don't have any
place to post that is publicly available.

Mike Moore
Accessibility Specialist
Department of Assistive and Rehabilitative Services (DARS)
(512) 424-4159