Opened 8 years ago

Closed 8 years ago

#12426 closed defect (fixed)

Changes to a dojox.mobile.app.TextBox do not fire watch("value",...

Reported by: Ed Chatelain Owned by: Shane O'Sullivan
Priority: high Milestone: 1.7
Component: DojoX Mobile Version: 1.6.0
Keywords: Cc: ben hockey, Douglas Hays
Blocked By: Blocking:

Description (last modified by bill)

Changes to a dojox.mobile.app.TextBox result in call to onChange, but do not call watch("value",...

The patch below for text-input-assistant.js can be used to recreate the problem. After applying the text-input-assistant.js.patch just run the dojox/mobile/tests/inputApp and update the simpleTextInput You will see in the console that onChange was called, but the watch was not called.

The problem is in _FormWidget.js the _FormWidget.js.patch has the fix. _FormWidget.js has 2 issues, first _FormValueWidget seems to be missing the _handleOnChange: function (which from looking at in dijit.form._FormWidgetMixin) should call this._set("value", newValue); .

After the change above, it still did not work because the _setValueAttr function in dojox.mobile.app._FormValueWidget is setting this.value = newValue; before calling this._handleOnChange(newValue, priorityChange); Setting this.value stops the watch from being called because it was will only fire the watch if the old value is not equal to the new value. In the patch I commented out the call to this.value = newValue; so with the patch watch("value") will be called when an update is made.

Patch from Ed (IBM, CCLA) to follow.

Attachments (2)

text-input-assistant.js.patch (849 bytes) - added by Ed Chatelain 8 years ago.
_FormWidget.js.patch (1023 bytes) - added by Ed Chatelain 8 years ago.

Download all attachments as: .zip

Change History (6)

Changed 8 years ago by Ed Chatelain

Changed 8 years ago by Ed Chatelain

Attachment: _FormWidget.js.patch added

comment:1 Changed 8 years ago by ben hockey

Cc: ben hockey added

comment:2 Changed 8 years ago by bill

Cc: Douglas Hays added
Description: modified (diff)

I think the goal is to just get rid of dojox.mobile.app.TextBox and use dojox.mobile.TextBox, right? (Hopefully watch() is working there, it should be.)

comment:3 Changed 8 years ago by Ed Chatelain

Thanks Bill, Yes dojox.mobile.TextBox? does fire the watch. I will change my code to use it. If dojox.mobile.TextBox? is what we should be using it would be good to have at least one mobile test testing it. Currently all of the tests in dojox.mobile using a TextBox? are using dojox.mobile.app.TextBox?.

comment:4 Changed 8 years ago by bill

Milestone: tbd1.7
Resolution: fixed
Status: newclosed

At this point dojox.mobile.app.TextBox just points to dojox.mobile.TextBox, so this issue must be resolved.

Note: See TracTickets for help on using tickets.