Opened 11 years ago

Closed 11 years ago

Last modified 9 years ago

#7086 closed defect (fixed)

[CLA][PATCH] dijit.form.SimpleTextarea show "undefined" on undefined value

Reported by: guest Owned by: Douglas Hays
Priority: high Milestone: 1.2
Component: Dijit - Form Version: 1.1.1
Keywords: Cc:
Blocked By: Blocking:

Description

dijit.form.SimpleTextarea? show "undefined" on undefined value, but should be empty.

Attachments (3)

simpletextarea.patch (337 bytes) - added by guest 11 years ago.
Created by Alessandro Ferrari
SimpleTextareaToTextBox.patch (1.5 KB) - added by alle 11 years ago.
Make SimpleTextarea? extend TextBox?
7086.patch (2.6 KB) - added by Douglas Hays 11 years ago.
added testcase to patch

Download all attachments as: .zip

Change History (12)

Changed 11 years ago by guest

Attachment: simpletextarea.patch added

Created by Alessandro Ferrari

comment:1 Changed 11 years ago by bill

Resolution: wontfix
Status: newclosed

You need to pass an argument to setValue(), setValue() and setValue(undefined) doesn't work for SimpleTextArea or TextBox either, for that matter.

comment:2 in reply to:  1 Changed 11 years ago by guest

Resolution: wontfix
Status: closedreopened

Replying to bill:
I think setValue() should get anything, usually taken from a data store, (null and undefined too) and the (form) widget should display it in a proper way.
TextBox define setValue(), with no type associated to value argument, and setDisplayedValue(), where value argument must be a string. filter() and format() methods let you customize it.
TextBox setValue() don't work, butsetValue(null) clear the field. Other TextBox methods format() and filter() respond to null and undefined in explicit way (see source).
Source structure and reference to #5329 let me think that desired behavior is that described at beginning of this comment.

My patch is very simple to change code as less as possible but give SimpleTextArea a similar behavior.
format() and filter() support in SimpleTextArea would be even better.

comment:3 Changed 11 years ago by bill

The documentation for TextBox.setValue() is confusing/vague because it describes not just TextBox but all widgets that extend TextBox. However, the only thing officially supported by TextBox is setValue("a string") or setValue("").

For SimpleTextArea to be completely consistent with TextBox's actual behavior, we would need setValue(null) to clear the field and setValue(undefined) to do nothing.

I could change it to ignore setValue(undefined) but would you prefer that to the current behavior?

comment:4 in reply to:  3 Changed 11 years ago by alle

More similar to TextBox's actual behavior I think is the better.

Inheriting SimpleTextarea from TextBox and not from _FormValueWidget would give a full behavior matching and format/filter support, but probably should be an other ticket ;-)

comment:5 Changed 11 years ago by bill

Milestone: 1.21.3
Owner: set to Douglas Hays
Status: reopenednew

Yah, perhaps SimpleTextArea? should extend TextBox?... Doug?

Changed 11 years ago by alle

Changed 11 years ago by Douglas Hays

Attachment: 7086.patch added

added testcase to patch

comment:6 Changed 11 years ago by Douglas Hays

onChange does not work with the current SimpleTextarea?. I recommend this ticket get moved back to 1.2.

comment:7 Changed 11 years ago by bill

Milestone: 1.31.2

OK great (I assume that means that you will fix it). Thanks.

comment:8 Changed 11 years ago by Douglas Hays

Resolution: fixed
Status: newclosed

Fixed in [14565].

comment:9 Changed 9 years ago by bill

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