Opened 10 years ago

Closed 9 years ago

#13359 closed defect (fixed)

dojox.form.TriStateCheckbox setting value on creation

Reported by: Kitson Kelly Owned by: Kitson Kelly
Priority: high Milestone: 1.8
Component: DojoX Form Version: 1.7.0b1
Keywords: Cc:
Blocked By: Blocking:


The TriStateCheckbox? does not allow you to specify a value during startup and fires an onChange, no matter what the initial value is during startup.

For example:

var myCheckbox = new dojox.form.TriStateCheckbox({
  id: "myCheckbox",
  value: "mixed",
  onChange: function(value) {

This will result in an output of false being logged to the console and display an unchecked Checkbox. Clicking the Checkbox once will return true and a third time to mixed. Also either omitting the value or setting it to false still causes an onChange to fire.

Attachments (1)

TriStateCheckBox.patch (15.2 KB) - added by Adam Peller 9 years ago.
patch from SiQi? Zhong (IBM, CCLA)

Download all attachments as: .zip

Change History (6)

comment:1 Changed 9 years ago by siqi

When you specify a value for a TriStateCheckBox? during startup, if the value is one of false, true, 'mixed', it will be simply ignored. If the value is something else, then the value of the TriStateCheckBox?(checked status) will be set to it. The parameter of the onChange event is the checked attribute of the TriStateCheckBox? rather than the value (dijit.form.CheckBox? has the same behavior). You can print the value of the TriStateCheckBox? with following code:

var myCheckbox = new dojox.form.TriStateCheckbox({
  id: "myCheckbox",
  value: "I'm checked!",
  onChange: function(value) {

The onChange event should not be triggered during startup and it's triggered before the value changed. It's a bug need to be fixed.

comment:2 Changed 9 years ago by Adam Peller

Owner: changed from dante to Kitson Kelly
Status: newassigned

Changed 9 years ago by Adam Peller

Attachment: TriStateCheckBox.patch added

patch from SiQi? Zhong (IBM, CCLA)

comment:3 Changed 9 years ago by Adam Peller

@kitsonk - attached a patch from SiQi and assigned to you. Please mark as 1.8, review and check in, if you feel comfortable. If not, assign back to me. Thanks.

comment:4 Changed 9 years ago by Kitson Kelly

Milestone: tbd1.8

comment:5 Changed 9 years ago by Kitson Kelly

Resolution: fixed
Status: assignedclosed

In [28527]:

Enhancements to TriStateCheckBox? that handle state changes better and allows setting during construction of indeterminate state. Refactor of test file to be AMD. Based on patch from SiQi? Zhong (IBM, CCLA), fixes #13359

Note: See TracTickets for help on using tickets.