Opened 16 years ago
Closed 16 years ago
#2918 closed Bug (fixed)
Initial values for checkboxes are wrong
Reported by: | Martin Kou | Owned by: | Martin Kou |
---|---|---|---|
Priority: | Normal | Milestone: | CKEditor 3.0 |
Component: | UI : Dialogs | Version: | SVN (FCKeditor) - Retired |
Keywords: | Review+ | Cc: |
Description
To reproduce the bug:
- Open replacebyclass.html in Firefox.
- Open the link dialog.
- Switch to target tab, and choose popup target. You should see 8 checkboxes which are not checked.
- Cancel and close the link dialog.
- Repeat step 3.
- But this time, all the checkboxes are ticked, which is wrong.
Attachments (3)
Change History (18)
Changed 16 years ago by
Attachment: | 2918.patch added |
---|
comment:1 Changed 16 years ago by
Keywords: | Review? added |
---|
comment:2 Changed 16 years ago by
Keywords: | Review+ added; Review? removed |
---|
You may change the fix to the following and commit it directly:
!!elementDefinition.checked
comment:4 Changed 16 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:5 Changed 16 years ago by
Resolution: | fixed |
---|---|
Status: | closed → reopened |
Ok.. turns out we're having another problem now.
If one of the checkboxes in the link dialog has a default value set to true...
default : true
Then the first opening of the dialog would display that checkbox as checked, yet subsequent openings would display is as unchecked.
The cause of this bug is because of the checkbox UI element constructor is looking for the 'checked' attribute for the default value, yet other parts of the plugin assumes the attribute should be called 'default'.
Changed 16 years ago by
Attachment: | 2918_2.patch added |
---|
comment:6 Changed 16 years ago by
Keywords: | Review? added; Review+ removed |
---|
comment:8 Changed 16 years ago by
Resolution: | fixed |
---|---|
Status: | closed → reopened |
Oops, make a mistake here, this ticket has nothing to do with [3054].
comment:9 Changed 16 years ago by
A probably related bug would be set checked:true in checkbox definition doesn't work. Procedures, confirmed on FF3:
- Setup by apply the test-checkbox-checked ;
- Open _samples\api_dialog.html;
- Open link dialog;
- Found the checkbox is left as unchecked.
comment:10 Changed 16 years ago by
Keywords: | Review+ added; Review? removed |
---|
comment:11 Changed 16 years ago by
Keywords: | Review- added; Review+ removed |
---|
Perhaps the patch doesn't handle the test case in comment:9, to take care the initial values, the override would result in something like:
var overrides = { 'default' :!!elementDefinition[ 'default' ] }; if ( typeof elementDefinition.checked !== 'undefined' ) overrides.initValue = !!elementDefinition.checked;
comment:12 Changed 16 years ago by
Oh, actually I've discussed with Fred about that yesternight before submitting the patch. To make the checked attribute work, you'd have to override the initial value related functions in addition to the change you proposed, which increases code complexity without much benefit in return. So the checked attribute in checkbox element definition was to be changed to 'default' instead.
comment:13 Changed 16 years ago by
Keywords: | Review? added; Review- removed |
---|
comment:14 Changed 16 years ago by
Keywords: | Review+ added; Review? removed |
---|
The bug was found to be due to the checkbox object constructor saving default value as an array instead of as a simply boolean value.