#16201 closed defect (worksforme)
dijit.Togglebutton behavior changed in dojo 1.7/1.8
Reported by: | millennium | Owned by: | Douglas Hays |
---|---|---|---|
Priority: | undecided | Milestone: | tbd |
Component: | Dijit - Form | Version: | 1.8.1 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
Upgraded a client application from dojo 1.6.1 to 1.8.
But I noticed the behaviour of the Togglebutton changed.
De widget with toggle buttons is part of an ASP.NET Webforms application (FYI: one big form). So I connected the onClick to an function which returns false, the prevent the default (submitting the form).
Second I have an Ajax onChange handler to save the states back to the server.
Since the update return false in de onClick prevents toggling. onChange fires but this.get("checked") is the old value. Which makes my widget quite useless
Attachments (1)
Change History (3)
Changed 8 years ago by
Attachment: | 16201.html added |
---|
comment:1 Changed 8 years ago by
Resolution: | → worksforme |
---|---|
Status: | new → closed |
Please attach a standalone testcase showing what is broken. I attached a small test comparing behavior to a native checkbox to show that it's working similarly. I don't understand when you say onChange fires since it should not fire since onClick="return false" will prevent the value from changing. In 1.6, "return false" did not prevent the default behavior. Note that you may want to use e.preventDefault() instead of "return false" in your onClick handler to stop form submit but still allow the value to change (similar to 1.6's incorrect behavior).
comment:2 Changed 8 years ago by
That's exactly the case: The widget relies on the apparently incorrect behaviour of 1.6 togglebutton. Which is changed (to correct behaviour) in 1.8. Which breaks backwards compatibilty without any notice in the release notes. It's a hard suprise when the client tells me it doesn't work anymore after the upgrade. While the release notes, pretents 1.8 is backwards compatible.
testcase showing CheckBox? subclass working OK