Issue with chosen harvesthq's jquery plugin

I'm using this plugin

http://harvesthq.github.com/chosen/

and I have an specific problem when I search some options with blanks. for example I have an option tha is "Antigua y barbuda" if I type :

  1. Antigua y barbuda -> ok
  2. Antigua y -> ok
  3. barbuda -> ok
  4. y -> ok
  5. y barbuda -> fail

it only fails when I start writing not the first word (only in cases that has blanks)

Regex:

regex = new RegExp(regexAnchor + searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), 'i');
zregex = new RegExp(searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), 'i');

Answers


This is might be a Chosen problem. Try using Select2 plugin, which originate from Chosen and its much better. Plus it allows custom matcher function so you can resolve your problem manually.


You don't need to remove \s just set search_contains: true

$(".chzn-select").chosen({search_contains: true});

Solved it removing "\s"

zregex = new RegExp(searchText.replace(/[-[\]{}()*+?.,\\^$|#]/g, "\\$&"), 'i');

For Joomla developers with similar issues:

JHtml::_('formbehavior.chosen', 'select', null, array('search_contains' => true));

Need Your Help

How to send email through IIS7?

c# iis-7 smtp

I'm trying to set up a SMTP server on my Windows 7 machine in IIS7. I have set it to "Deliver email to localhost, port 25, no authentication. But when I try to connect programmatically from my C#

Atomic UPDATE .. SELECT in Postgres

multithreading postgresql concurrency race-condition transaction-isolation

I'm building a queuing mechanism of sorts. There are rows of data that need processing, and a status flag. I'm using an update .. returning clause to manage it: