Hi,

when I try to add new terms for e.g 1234567890, after saving the node, it will always truncate the first 2 and last 2 character of the terms and become 345678 only.

can always reproduce no matter what I key in.

Hope someone can help, great module tho..

Comments

dusov’s picture

When adding any term new or exist
Reason this code
autocomplete_deluxe.module line 302

// Remove the double quotes at the beginning and the end from the first and
  // the last term.
  $element['#value'] = substr($element['#value'], 2, strlen($element['#value']) - 4);
maxchock’s picture

what is the point of this code? any reason remove the string before knowing whether is it quotes or double quotes?

steven.wichers’s picture

I created a patch with a temporary workaround.

Fidelix’s picture

Priority: Normal » Major

The module is totally unusable without this.

Should be critical, but I'm setting it to major because I'm not sure if it applies to terms as well, or just nodes.

sepgil’s picture

what is the point of this code? any reason remove the string before knowing whether is it quotes or double quotes?

It removes the double quotes generated by multiple widget. Since the single widget doesn't uses double quotes to wrap the values, it will truncate the value itself.
Anyway, I've fixed the bug and the single widget should now work properly.

sepgil’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

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

DeNelo’s picture

I applied the patch in #3. However, I have two ADX fields (X and Y) in the node type. Completing X and leaving Y empty creates a new taxonomy term in the vocabulary of Y called " (one double quotes).
Editing and saving the node, and still not entering anything for term Y, creates a new term: """ (three double quotes). I have not gone on from there, but there is a pattern...

desierto’s picture

Status: Closed (fixed) » Needs review

A fix (maybe the patch in #3, which appears to work) needs to be put in Beta. The module is not useful otherwise... worse than that, it truncates your terms as you edit nodes. If you edit a node multiple times it will even create multiple terms you didn't have before, each with 2 characters less in the beginning and end then the previous version.

4kant’s picture

#3 worked for me. Thanks!

marioangulo’s picture

Added on to the fix posted on comment #3. My fix checks if the field is using the multiple type attribute to properly truncate from that field only on not the single field type.

Also I believe #3 had a typo on its regex check with that comma added.

marioangulo’s picture

Recreated my patch to just only perform the check if it's a multiple field before truncating. The regex check above didn't capture all situations and was creating terms that were blank or just containing quotations when saving nodes.

rooby’s picture

This is a pretty nasty bug.

Re #12:

+++ b/autocomplete_deluxe.module
@@ -343,9 +343,15 @@ function autocomplete_deluxe_after_build($element, &$form_state) {
+    if($element['#multiple'] == TRUE) {
+

Missing space after if keyword and extra blank line.

+++ b/autocomplete_deluxe.module
@@ -343,9 +343,15 @@ function autocomplete_deluxe_after_build($element, &$form_state) {
+    }
+    ¶

Trailing whitespace.

Also attached is a version for 7.x-2.0-beta2, for anyone who wants that.

desierto’s picture

Version: 7.x-2.x-dev » 7.x-2.0-beta2
Priority: Major » Critical

This bug is still not fixed in the main beta release even though several releases have come out since this serious bug was identified. Can the maintainer please roll this patch (or a varient) into the main release. This is really becoming annoying to have to patch every release manually.

rsvelko’s picture

Issue summary: View changes

+1 for wraooing into an if statement.
Also some smart trimming of quotes instead of substr would be way better.
Will post a a patch in a few hours.

rooby’s picture

Here is a new reroll for latest 7.x-2.x-dev.
It also addresses the minor issues mentioned in #13.

neograph734’s picture

Status: Needs review » Reviewed & tested by the community

Thanks rooby, you saved my day.

LNakamura’s picture

Status: Reviewed & tested by the community » Closed (cannot reproduce)

I no longer see this problem with the current 7.x-2.x dev release - if anyone does still see it, let me know and I'll reopen this issue.

Thanks!