Combo Bug - does not support text with [] in them properly

Hi,

I’ve got the following select box:

[All Sizes]
20’
40’
40’ RF
LCL

By default, the [All Sizes] is displayed.

However, whenever I click in the combo box, the field automatically changes to LCL. After some debugging, I realized that the problem lies in the filterSelf() method.

      try{ var filter=new RegExp("^"+text,"i"); } catch (e){ var filter=new RegExp("^"+text.replace(/([\[\]\{\}\(\)\+\*\\])/g,"\\$1")); }

Given that text is [All Users], filter then becomes “/^[All Users]/i”. Which means that the only option that matches is “LCL” (ie: starts with ‘L’).

The fix is fairly evident. Modify the line to read:

      var filter=new RegExp("^"+text.replace(/([\[\]\{\}\(\)\+\*\\])/g,"\\$1"));

The question is if there is a reason why this isn’t done directly in the first place, rather than only in the catch block?

Thanks,

Eric

Hi,

your modification won’t cause the problems in filtering functionality.

But why is it not done that way in the first place? Is there a particular reason why the code is written the way it is?

Thanks,
Eric

Is there a particular reason why the code is written the way it is?

Probably there was not a particular reason