Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#14985 closed defect (duplicate)

dijit.form.RadioButton set checked priorityChange bugs

Reported by: vtsuper Owned by: Eugene Lazutkin
Priority: undecided Milestone: 1.5.3
Component: DojoX Form Version: 1.5
Keywords: Cc: ben hockey
Blocked By: Blocking:

Description

accroding to the following example, I found that there are some bugs on radioButton

http://jsfiddle.net/vtsuper/3HJWe/9/

when I press setFromValues button, data pass to the dijit. Since setFormValues call XXX.set('value','YYYY', false) so normally it won't trigger any event. It works in most dijit except radioButton. From the example you can see the log was trigger by radioButton

In dojox.form.manager_Mixin.js

formWidgetValue:function(){

array.forEach(elem, function(widget){

widget.set("checked", false, !this.watching);

});

array.forEach(elem, function(widget){

widget.set("checked", widget.value === value, !this.watching);

}); }

I think the problem is come from this function

Change History (7)

comment:1 in reply to:  description Changed 7 years ago by vtsuper

I can provide more information about this case. the problem should be come from here

dojox.form.manager setFromValue -> formWidgetValue ->

widget.set("checked", widget.value === value, !this.watching);
//actually watching is same with priorityChange

but actually in _RadioButtonMixin.js , it won't handle the priorityChange flag so it always trigger the observer function. so how to solve this case?

_setCheckedAttr: function(/*Boolean*/ value){
	// If I am being checked then have to deselect currently checked radio button
	this.inherited(arguments);
	if(!this._created){ return; }
	if(value){
		array.forEach(this._getRelatedWidgets(), lang.hitch(this, function(widget){
			if(widget != this && widget.checked){
				widget.set('checked', false);
			}
		}));
	}
},

Replying to vtsuper:

accroding to the following example, I found that there are some bugs on radioButton

http://jsfiddle.net/vtsuper/3HJWe/9/

when I press setFromValues button, data pass to the dijit. Since setFormValues call XXX.set('value','YYYY', false) so normally it won't trigger any event. It works in most dijit except radioButton. From the example you can see the log was trigger by radioButton

In dojox.form.manager_Mixin.js

formWidgetValue:function(){

array.forEach(elem, function(widget){

widget.set("checked", false, !this.watching);

});

array.forEach(elem, function(widget){

widget.set("checked", widget.value === value, !this.watching);

}); }

I think the problem is come from this function

Last edited 7 years ago by vtsuper (previous) (diff)

comment:2 Changed 7 years ago by Douglas Hays

Cc: ben hockey added
Component: Dijit - FormDojoX Form
Owner: changed from Douglas Hays to Eugene Lazutkin
Status: newassigned
Version: 1.6.01.5

Refs #11284. The problem is in dojox/form/manager/_Mixin.js.
"this.watching" is undefined within

array.forEach(elem, function(widget){
    widget.set("checked", false, !this.watching);
});
array.forEach(elem, function(widget){
    widget.set("checked", widget.value === value, !this.watching);
});

comment:3 Changed 7 years ago by ben hockey

Resolution: duplicate
Status: assignedclosed

Duplicate of #12590.
as soon as the patch on #12590 is applied this will be fixed

comment:4 Changed 7 years ago by Douglas Hays

In [28194]:

Fixes #12590, refs #14985. Proxy commit for neonstalwart to define 'this' context for 'watching' object member, backported to 1.5 where the regression first occurred. !strict

comment:5 Changed 7 years ago by bill

Milestone: tbd1.5.3

comment:6 Changed 7 years ago by bill

Looks like this one should also be closed?

comment:7 Changed 7 years ago by ben hockey

it's already closed

Note: See TracTickets for help on using tickets.