Opened 7 years ago

Closed 7 years ago

#14644 closed defect (fixed)

[patch] [cla] bug in dijit/form/_AutoCompleterMixin

Reported by: Martin Repta Owned by: Douglas Hays
Priority: high Milestone: 1.8
Component: Dijit - Form Version: 1.7.1
Keywords: filteringSelect, dijit, _AutoCompleterMixin Cc: martinerko@…
Blocked By: Blocking:

Description

We found that dijit.form.FilteringSelect? is not working correctly and probably all other widgets that inherits from dijit/form/_AutoCompleterMixin.

In out sample, we have filteringSelect with store which contains data with item where id == 0. When you try to select item with id == 0, the value of filteringSelect will be empty string.

Problem is inside condition, where _AutoCompleterMixin checks if value is not null. But this condision returns true also when value is 0.

I have attached sample to demostrate problem and also patch file.

Attachments (2)

patch.txt (557 bytes) - added by Martin Repta 7 years ago.
sample.html (1.3 KB) - added by Martin Repta 7 years ago.

Download all attachments as: .zip

Change History (6)

Changed 7 years ago by Martin Repta

Attachment: patch.txt added

Changed 7 years ago by Martin Repta

Attachment: sample.html added

comment:1 Changed 7 years ago by ben hockey

technically this is not a bug since values are supposed to be strings

_setValueAttr: function(/*String*/ value, /*Boolean?*/ priorityChange, /*String?*/ displayedValue, /*item?*/ item){

if you change your ids to be strings then "0" will be handled properly.

i'll leave this open for doug or bill to decide what to do with it but i've seen a number of issues closed because values are integers rather than strings. i think its quite common that people don't realize that values have to be strings and personally, i'd like to see integers be valid values, but for now they're not.

comment:2 Changed 7 years ago by Martin Repta

I think it is a bug, because it can accept integer values, but not 0, because condition if(!value) is not enough!

comment:3 Changed 7 years ago by Douglas Hays

Milestone: tbd1.8
Status: newassigned

comment:4 Changed 7 years ago by Douglas Hays

Resolution: fixed
Status: assignedclosed

In [27621]:

Fixes #14644. Explicitly check for null/undefined to avoid integer 0 value failure.

Note: See TracTickets for help on using tickets.