PDA

View Full Version : moving focus() off an input when "hiding"


bk1
11-21-2002, 12:48 AM
Hi,

I am toggling the visibility of part of a form with a checkbox, and am running into a problem with submitting the form if the focus is on an input, which is then hidden.

The error I'm getting is:

"Can't move focus to the control because it is invisible, not enabled, or of a type that does not accept the focus."

How can I get the focus off of the hidden input?

thanks in advance! :confused:

glenngv
11-21-2002, 02:49 AM
remove focus BEFORE hiding the field.

document.FormName.FieldName.blur();
//hide the field here

bk1
11-21-2002, 04:07 AM
cool, totally makes sense! I was trying to put it after.

Thanks glenngv.

:)