Opened 11 years ago

Closed 11 years ago

Last modified 9 years ago

#7630 closed defect (fixed)

FilteringSelect: can't map empty label to value

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

Description (last modified by bill)

Hi

When the combo box contains an item that is blank it is not recognized as legal, the returned value will be indefined.

This behavior is new.

Correct and desired behavior: the set attribute 'value' must be returned, even if displayed value is empty.

See attached show case:

Replication:

  1. in on button clickme.
  2. dialog with combo will be displayed (default value=-1, displayed value: blank)
  3. click on dialog, yellow color will be displayed (not valid)
  4. click ok for any other item or for the last (the value:-1 item)

I think that this issue is pretty critical for the usage of the combo.

thanks !

Eduardo

Attachments (1)

dialogCombobox.html (3.6 KB) - added by taras 11 years ago.
FilteringSelect? Problem

Download all attachments as: .zip

Change History (16)

Changed 11 years ago by taras

Attachment: dialogCombobox.html added

comment:1 Changed 11 years ago by Douglas Hays

Resolution: fixed
Status: newclosed

(In [15194]) Fixes #7630. Removed the short-circuit case for a blank displayed value that precluded this situation.

comment:2 Changed 11 years ago by Douglas Hays

Milestone: tbd1.2

comment:3 in reply to:  1 Changed 11 years ago by bill

Description: modified (diff)
Summary: Bug in dijit.form.FilteringSelect . Empty or space in display Value is not legalFilteringSelect: can't map empty label to value

Replying to doughays:

(In [15194]) Fixes #7630. Removed the short-circuit case for a blank displayed value that precluded this situation.

Hmm, the code removed in this checkin was intentionally added in [15118] as part of #5974, to

  • prevent a bunch of spurious requests to the data store on page load (a performance issue for remote data stores)
  • to work around a data store's bug/behavior where a query on "" returned all items instead of the single item with value=""

Albeit, it only half-fixes the performance issue since FilteringSelect will still ping a data store any time the value != "".

Note that the text in the ticket description is inaccucurate:

When the combo box contains an item that is blank it is not recognized as legal

Assuming that you haven't specified required=true, a blank <input> is considered legal. It's just that you can't specify a mapping from a blank display value to a value like -1. IE, blank values in the data store aren't supported.

comment:4 Changed 11 years ago by taras

I add this only to clarify some usability issues:

[1] In my opinion it doesn't make sense to obligate the user to delete the displayed value in order to input a blank string (in case for example that he want to indicate to the application to remove or delete a previous are a default value) [2] Even if he will do [1] from the visual point of view, the combo will display the invalid 'yellow color' and also from the user interaction point of view is not OK. [3] It is not critical that if blank is chosen, a null value is returned instead of the given value '-1' (as in my example). The critical issue is that if specified in the list of values (only if) the blank value must be recognized as legal (not yellow).

thanks !

comment:5 Changed 11 years ago by bill

As per (2) and (3) in your list above (BTW you should write lists using 1. 2. 3. and indented at least one space, to get correct wiki formatting), is it really getting a yellow color for you, because the first example in test_FilteringSelect.html lets you clear the value without giving yellow.

comment:6 in reply to:  5 Changed 11 years ago by taras

Replying to bill:

As per (2) and (3) in your list above (BTW you should write lists using 1. 2. 3. and indented at least one space, to get correct wiki formatting), is it really getting a yellow color for you, because the first example in test_FilteringSelect.html lets you clear the value without giving yellow.

Ok understood: required="false" is the answer

thanks

comment:7 Changed 11 years ago by taras

Bill

By the way I am not in my office now so I cannot test this more rigorously, but do you saw the behavior in FF3 of the first Combo?

[1] Choose for instance Connecticut.

[2] Try to change the item.

[3] When you try to open the list, the combo displayed value will display Kansas

I hope that this is not a local problem I have.

Eduardo

comment:8 Changed 11 years ago by bill

Eduardo: write lists using 1. 2. 3. rather than brackets, because brackets signify commit numbers in SVN.

I don't understand your bug description above... "Try to change the item" could mean a number of things, such as picking something from the drop down or typing in a value manually or a combination of those actions. It could be using the mouse or the keyboard. Anyway, I tried to reproduce the problem but I didn't see any behavior in FF3/mac where opening the drop down list would suddenly make the displayed value change. If you can reproduce that please file another ticket with detailed instructions on how to reproduce. Thanks!

As for the required=false thing, I guess I was picturing that if you had a drop down with a "blank" choice it would be displayed with a word like <none>. For example, under special meal choices (for an airline flight), the drop down would look like:

  • <none>
  • veggie
  • low fat
  • ...

Maybe that's not realistic?

FYI, the thinking behind required=false is to support a FilteringSelect field which isn't required running against a data store w/out a "blank" entry.

comment:9 Changed 11 years ago by taras

Hi Bill

1.0 Your idea about the <none> in my opinion is very, very nice and very easy for any new 'dojer' to understand, and will save some lines of coding to it.

So

theValue=widget.attr('value');

theValue will be undefined for displayValue='<none>'

and easily recognized as

if(!theValue){

alert('you chose: <none>');

}else{

.....

}

2.0 About the problem in the test, above (test_FilteringSelect.html ), I saw it in Windows (I havn't Mac here), but please if you cannot trivially replicate it, do not expend time. I will try to check it in another 5-6 hours when I return to my Lab and write you a message.

thanks

Eduardo

comment:10 Changed 11 years ago by Douglas Hays

Resolution: fixed
Status: closedreopened

comment:11 Changed 11 years ago by Douglas Hays

Owner: set to Douglas Hays
Status: reopenednew

comment:12 Changed 11 years ago by taras

Hi

There is no problem at all in the test_FilteringSelect.html program.

Eduardo

comment:13 Changed 11 years ago by bill

Resolution: fixed
Status: newclosed

OK, I'm going to close this for now. The code in question was a nice optimization on page load and also works around a data store issue but unfortunately also breaks back-compatibility (ie, the ability to map "" to -1).

Maybe for 2.0 we should reconsider that.

comment:14 Changed 11 years ago by bill

See also #5974, the original ticket related to this.

comment:15 Changed 9 years ago by bill

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