Could you, please, add an option to desable case sensitive?

Comments

markus_petrux’s picture

Status: Active » Needs work

This is not on my top priority list, so I would appreciate a patch for review.

On the other hand, if you use the "Autocomplete for existing field data" widget, you may try using a case insensitive charset for your database, or maybe just the column of this particular field.

http://dev.mysql.com/doc/refman/5.0/en/charset-mysql.html

markus_petrux’s picture

markus_petrux’s picture

Status: Needs work » Postponed

Postponing until someone can come up with a patch.

I wrote this module for the project I'm working on, but we don't need this feature, and I'm currently pretty busy with other stuff on that project. Then, I'm sure there will be more work on the road, so I don't thing I'll have the time for this feature request unless a bit of time can be scheduled for it. See the note about "Support/Feature requests" in my profile.

markus_petrux’s picture

Status: Postponed » Fixed

I have committed this feature to CVS. Need update.php

http://drupal.org/cvs?commit=270926

Daniel A. Beilinson’s picture

Thank you, Markus.

Daniel A. Beilinson’s picture

Status: Fixed » Active

when i switched off case sensitive for myfield and try to edit node with myfield (even if i don't edit myfield's value) i get this validation error:
"myfield: found no valid option".

markus_petrux’s picture

Status: Active » Fixed

This may happen when you're using an Autocomplete for Allowed Values Widget and the value of the field does not match the case of a valid option. Here, the check is not case insensitive.

Note that the case sensitive option is applied when you start typing a value in the form element. Here the autocomplete widget will render candidates based on the case sensitivity option defined for the field, but you should choose a value from the list of candidates. If you do not choose a value from that list, then the field will not validate because the case will not match.

In summary, the case sensitivity option is used only to filter candidates when typing, but the final value entered in the field should match the case of allowed values.

This is the same exact pattern applied to other autocomplete widgets in Drupal. For example, see the "Participant" field in the "Search issues" panel:

http://drupal.org/project/issues/search/autocomplete_widgets?participant...
http://drupal.org/project/issues/search/autocomplete_widgets?participant...

The former works, while the later fails when the only difference is the case of the first letter of your username.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

igorik’s picture

Category: feature » bug
Status: Closed (fixed) » Active

Hi Marcus,

Currently disabling case senstitive doesn't work, exactly as Daniel wrote in #6.

Concrete example: I have turned on validation by case sensitive. Node is stored fine. Then I disable case sensive for this field in his content type, then I click on edit already stored node, and I am trying to save it *without any changes*
Then I got error "myfield: found no valid option", although the word in autocomplete field is 100% correct and it was correctly stored with case sensitive enabled.

this surely isn't normal behaviour - disabling case sensitive doesn't work at all.

Big thanks for your work on this bug.

Igor

markus_petrux’s picture

Status: Active » Needs review

hmm... could you please try the following mini-patch to autocomplete_widgets.common.inc, function _autocomplete_widgets_get_options_allowvals():

-  if ($case_insensitive) {
+  if ($case_insensitive && $match != 'equals') {
igorik’s picture

Status: Needs review » Fixed

Hi Marcus,

great, yes, it now works.

Many thanks for quick fix.

Igorik

markus_petrux’s picture

Thanks for confirming the patch! :)

Committed to CVS:
http://drupal.org/cvs?commit=306140

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.