Opened 11 years ago

Closed 11 years ago

Last modified 8 years ago

#7151 closed defect (fixed)

FilteringSelect: problem with \(backslash)

Reported by: fms Owned by: bill
Priority: high Milestone: 1.2
Component: Dijit - Form Version: 1.1.1
Keywords: FilteringSelect backslash Cc:
Blocked By: Blocking:


When selecting an item that contains a '\'(backslash) from FilteringSelect?, 'The value entered is not valid' is shown even though it is valid.

In 1.1.1, the problem occurs with FilteringSelect?, and a data store other than dijit.form._ComboBoxDataStore(default), such as
dijit.form._ComboBoxDataStore escapes meta characters of RegExp?() on its own, whereas other data stores use instead.

In trunk(r14389), the problem occurs with FilteringSelect? and any data store, including dijit.form._ComboBoxDataStore.
In the changeset r14220, dijit.form._ComboBoxDataStore has been fixed to escape meta characters using just like other data stores, making the same problem to occur in dijit.form._ComboBoxDataStore as well.

Since '\' is a meta character of, '\'s in the label of FilteringSelect? must be escaped.

Sample patches to both revisions are attached.

Regards, fumifumi@…

Attachments (2)

patch-filteringselect-backslash-r14388.udiff (718 bytes) - added by fms 11 years ago.
patch-filteringselect-backslash-1.1.1.udiff (1.5 KB) - added by fms 11 years ago.

Download all attachments as: .zip

Change History (10)

comment:1 Changed 11 years ago by bill

Isn't the real problem in ?

comment:2 Changed 11 years ago by fms

I think itself is working correctly in that it converts a "pattern" string containing "*" and "?" using "\" as the escape character into a RegExp? with ".*" and ".", respectively. FilteringSelect? indirectly uses as a result of a sequence of function calls, so as long as such call sequence is maintained, the "pattern" needs to be specified in a manner that expects.

I made an additional correction to the code, and replaced the previous code with the new one.

comment:3 Changed 11 years ago by bill

Milestone: tbd1.3
Owner: set to haysmark

Hmm, Mark, what do you think?

Extrapolating from this ticket description it seems like if you select "3 * 5" from the drop down list it should show up in the <input> box as "3 \* 5". IE, that \, *, and . need to be escaped to form a pattern.

I'm torn though... because it would also be nice if the <input> box displayed exactly what the user selected (so they don't get confused).

comment:4 Changed 11 years ago by bill

PS: and how does this affect the value submitted with the form? We want "3 * 5" to be submitted, not "3 \* 5".

comment:5 Changed 11 years ago by fms

The main problem is that if you select an item

  <option value="val1">some\doc\folder1</option>

from a drop-down list

<select dojoType="dijit.form.FilteringSelect"> 
  <option value="val1">some\doc\folder1</option>
  <option value="val2">some\doc\folder2</option>

an error "The value entered is not valid" occurs, and nothing goes into the .value property after r14220, and the same error occurs with 1.1.1 when the FilteringSelect? is connected to which contains data like above. The string "some\document\folder1" should still be displayed in the drop down-list, but this error shouldn't occur.

In order to fix the problem and stop this error to occur, I escaped the string just before it gets passed to, so the string that is displayed, as well as the one that goes into the .value property remains in the original form (i.e. no escape).

I hope this clarifies my point.

It may be necessary to revisit the overall design of FilteringSelect?, ComboBox?, "pattern", and RegExp?, but in the meantime, I stongly believe this fix at least needs to be reflected in 1.1, because it affects because it affects everyone that uses FilteringSelect? with a special data store other than dijit.form._ComboBoxDataStore. Moreover, r14220 is making this to affect everyone that uses FilteringSelect? with any data store including dijit.form._ComboBoxDataStore(default).

comment:6 Changed 11 years ago by bill

Milestone: 1.31.2
Owner: changed from haysmark to bill
Status: newassigned

Oh I see... yah that makes sense, I'll check in.

comment:7 Changed 11 years ago by bill

Resolution: fixed
Status: assignedclosed

(In [14477]) Fixes #7151: FilteringSelect? problem where the field goes yellow after selecting something from the drop down with a backslash, and then tabbing away. !strict

comment:8 Changed 8 years ago by bill

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