Forum Moderators: open

Message Too Old, No Replies

Triggering property changes with onclick, not onchange.

Disabling with onchange is buggy in IE, but onclick is OK.

         

thesheep

10:04 pm on Aug 24, 2005 (gmt 0)

10+ Year Member



It seems that IE is buggy about disabling form elements dynamically if the change is fired from an 'onChange' event on another element (like a checkbox) rather than 'onClick', although FF is OK. If I set an element's 'disabled' property in a script this way, my version of IE6 doesn't update the appearance of the disabled form element straight away. Only when you try to click it does it suddenly become grayed out. The reverse also happens: a greyed out element is slow to return to its active appearance.

If there really is such a bug I guess it could be a problem. If the user tries to navigate the form using a keyboard and no mouse, presumably this will trigger onchange but not onclick. What is the most professional, cross-browser method of dynamically disabling form elements?

Dijkgraaf

12:11 am on Aug 25, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



One method I use, rather than disabling the control, I hide it instead. This is of course only used where that control is sometimes not relevant depending on what the user selected.