View Full Version : 50% working
05-02-2006, 10:48 PM
I'm trying to get the following code to activate and deactivate one form field by using one button.
Activating the field works. De-activating it is not.
05-02-2006, 11:14 PM
It seems so obvious that I must be missing something. What happens if you try this?
05-02-2006, 11:29 PM
I've tried that; didn't work.
The field becomes active but will not de-activate when a user pushes the button again.
05-02-2006, 11:40 PM
Do you need the Department variable? What if you just negate the disabled condition?
document.form1.Department.disabled = !document.form1.Department.disabled;
05-03-2006, 03:14 PM
That's got it.
05-03-2006, 10:34 PM
Just to explain what happened here:
you were using the assignment operator and not the comparison operator:
Department="disabled" vs Department=="disabled"
because of this, Department was always "disabled", hence your behavior.
05-03-2006, 11:02 PM
good call beagle
i noticed that too just now
ive made this mistake a few times as well
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.