Opened 10 years ago

Closed 10 years ago

Last modified 8 years ago

#9742 closed defect (invalid)

NumberTextBoxes not being found with dijit.findWidgets() or dijit.getChildren()

Reported by: Pete Smith Owned by:
Priority: low Milestone: tbd
Component: Dijit - Form Version: 1.3.2
Keywords: Cc: Douglas Hays
Blocked By: Blocking:

Description

This is repeatable even off the

http://download.dojotoolkit.org/release-1.3.2/dojo-release-1.3.2/dijit/tests/form/test_validate.html

go into firebug and do

dijit.findWidgets(document.forms.example)

You will see, no NumberTextBoxes? are found. This stops them from being validated with dijit.form.validate().

Change History (4)

comment:1 Changed 10 years ago by Pete Smith

to show even more strangeness, if I do a forEach and console.log each widget, it logs:

constraints=Object _connects=[4]

(which is somehow broken object?)

comment:2 Changed 10 years ago by bill

Priority: highlow
severity: criticalminor

Oh it's finding them, it's just that NumberTextBox displays strangely in the debugger, probably because NumberTextBox.toString() prints out a confusing value (as you listed above). The object is not broken. Try:

dijit.byId("q03").declaredClass
dijit.byId("q03").id

etc. to see that the members are intact. And try

dijit.byId("q03")

to see what toString() is returning.

If you have a test case where they aren't getting validated please attach it.

comment:3 Changed 10 years ago by bill

Cc: Douglas Hays added
Resolution: invalid
Status: newclosed

More info on this: _Widget.js defines a toString() method and that's what usually appears in firebug output:

toString: function(){
	...
	return '[Widget ' + this.declaredClass + ', ' + (this.id || 'NO ID') + ']'; // String
},

I think that NumberTextBox is picking up the toString() from MappedTextBox:

toString: function(){
	var val = this.filter(this.attr('value')); // call filter in case value is nonstring and filter has been customized
	return val != null ? (typeof val == "string" ? val : this.serialize(val, this.constraints)) : ""; // String
},

and that's returning "". Of course the debugger can't print "" to represent an object, so I guess it is using some internal routine to print the link. It's confusing but I don't think there's anything we can do to change it, since toString() is being used in other parts of the code to refer to the value that the NumberTextBox holds.

comment:4 Changed 8 years ago by bill

Component: DijitDijit - Form
Note: See TracTickets for help on using tickets.