Closed
Bug 295925
Opened 19 years ago
Closed 19 years ago
textbox remains disabled after setting disabled attribute to false
Categories
(Core :: XUL, defect)
Tracking
()
RESOLVED
DUPLICATE
of bug 174492
People
(Reporter: mark, Unassigned)
Details
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050509 Firefox/1.0.4
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050509 Firefox/1.0.4
If a javascript from chrome sets a textbox 'disabled' attribute to true this
textbox can not be enabled later by setting the 'disabled' attribute to false.
Reproducible: Always
Steps to Reproduce:
1. Create a textbox in XUL
2. Attach a simple script to a button which sets the disabled attribute to true
3. Create another button which sets the disabled attribute to false
4. Attempt to click on the textbox. focus fails.
Actual Results:
a textbox set with disabled="false", then later set with disabled="true" should
allow focus to occur. Focus fails and textbox remains unuseable.
Expected Results:
textbox with disabled="false" should allow focus to occur.
document.getElementById('myTextBox').setAttribute('disabled','true');
document.getElementById('myTextBox').setAttribute('disabled','false');
// focus fails
document.getElementById('myTextBox').focus();
// my current work around it works but ain't pretty
// disable textbox hack
document.getElementById('myTextBox').setAttribute('style','color:gray');
document.getElementById('myTextBox').setAttribute('onfocus','this.blur();');
// enable textbox hack
document.getElementById('myTextBox')setAttribute('style','color:black');
document.getElementById('myTextBox')setAttribute('onfocus','this.focus();');
http://www.xulplanet.com/references/elemref/ref_textbox.html#attr_disabled
To enable the textbox fully, use elt.removeAttribute('disabled');
However, the visual feedback when disabled is set to "false" is deceiving.
There may already be a bug for this.
Also, there's a direct property in JavaScript... elt.disabled = (true|false).
That worked just fine for me.
Might this be a dup of bug 118683?
Comment 3•19 years ago
|
||
can you attach a testcase ?
Reporter | ||
Comment 4•19 years ago
|
||
elt.removeAttribute('disabled') enables the textbox but there is no visual
feedback when elt.disabled='true' is set.
I got around this lack of feedback problem by using elt.style.color="gray" when
the element is disabled. The textbox appearance needs to change in some way so
the user can recognize it is disabled.
Updated•19 years ago
|
Component: General → XP Toolkit/Widgets: XUL
Product: Firefox → Core
QA Contact: general → xptoolkit.xul
Version: unspecified → 1.0 Branch
Comment 5•19 years ago
|
||
dupe of "setAttribute("disabled", false) causes textbox to not function properly"
see comment 5 in that bug for what's going on.
*** This bug has been marked as a duplicate of 174492 ***
Status: UNCONFIRMED → RESOLVED
Closed: 19 years ago
Resolution: --- → DUPLICATE
Component: XP Toolkit/Widgets: XUL → XUL
QA Contact: xptoolkit.xul → xptoolkit.widgets
You need to log in
before you can comment on or make changes to this bug.
Description
•