Title: Message
Hi, List
 
I've got an interesting timing problem with a form that uses setFocus().
 
Picture this first page of a form:
The second last question is a yes/no checkbox.  "Yes" response unlocks (readonly=false) two other sub-groups of check boxes.
The last question is a simple numeric field.
The last item in that page's tab order is a WWW link (not by choice).
 
I've added logic to lock up the sub-category questions into the yes/no check boxes.  If the response is "Yes", the fields are unlocked and the first field is tabbed into using setFocus().  So far so good.
 
I've also added a setFocus() to the onBlur action in the last (numeric) field on the page to tab "past" the WWW Link (at the top of the page) right to the first question on page 2.
 
Here's where the problems begin - When the user hits "TAB" after the main yes/no check box, the cursor first goes to the next "unlocked" (readonly = false) field which in this case is the numeric field.  Usually the script then fires and puts the cursor into whatever field the setFocus() command states.  The problem with this scenario, however, is that the numeric field also has a setFocus() command in it - in the "onBlur" action.  So before my first script (in the check boxes) can fire and set the cursor into the field I want, the onBlur script in the numeric field fires, sending the cursor to the second page.
 
Is there anything I can do about this?  I know why it's happening (the cursor travels before the _javascript_ is run and the onBlur action of the field the cursor is in overrides the onBlur action of the original checkbox).  I really hope this makes sense...
 
Yeah, Max, I know - Friday again...
 

Mark Lauterbach
Forms Designer
Citizenship and Immigration Canada
957-2798

"Reason has always existed, just not always in a reasonable form."

Reply via email to