Original comment http://drupal.org/node/1022940#comment-3933186

I'm wondering if this has anything to do with the ajax call to lookup a node when entering an external link (or other text). I was using the linkit button to insert a link to an external site. I started typing 'http://www' and was eventually given a popup error (javascript?).

An AJAX HTTP error occurred.
HTTP Result Code: 404
Debugging information follows.
Path: http://www.foggyperspective.com/admin/linkit/autocomplete
StatusText: Not Found
ResponseText: []

CommentFileSizeAuthor
#22 1024460.patch850 bytesswentel
#7 linkit.1024460.patch2.35 KBanon
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

caschbre’s picture

Do the slashes not work with any autocomplete within drupal or just the linkit autocomplete?

Maybe the UI just needs to be broken up (i.e. two tabs) to allow a standard textbox for external links and a search tab for linking to internal content. This also reduces ajax calls when someone is entering external links.

anon’s picture

Tryed to enter slash into Authored by field for a node now, and that also throws the same error msg.

Since this is working in D6, or at least the autocomplete stops searching when a slash is given in Linkit, Im quite sure that this can be fixed here too, but Im not 100% sure.

I think this has something todo with the paths in hook_menu.

linkit/autocomplete is becoming linkit/autocomplete/sometext/whatever where [sometext/whatever] is given.

Another weird thing is that if Im giving just a dot (.) this freaks out in Linkit, but not in Authored by field.

vitok-dupe’s picture

Seems that this is drupal core bug, because if typing slash in default tags field, it's giving same error.

vitok-dupe’s picture

Status: Active » Closed (won't fix)

So now anon you clear to giving us 1.1 release. And can you also open bug report for drupal core?

caschbre’s picture

I'm not necessarily sure I'd mark this as won't fix. If the auto-complete doesn't allow for slashes due to a bug or by design, the linkit module won't allow for external links. I would think linkit needs to alter the design to allow for external links or remove the ability.

anon’s picture

Status: Closed (won't fix) » Active

Actually I agree with caschbre.

I was thinking, what if a simple JS script could remove the connection to the core autocomplete if a slash is given?

Found this in misc/drupal.js

/**
 * Attach all registered behaviors to a page element.
 *
 * Behaviors are event-triggered actions that attach to page elements, enhancing
 * default non-Javascript UIs. Behaviors are registered in the Drupal.behaviors
 * object using the method 'attach' and optionally also 'detach' as follows:
 * @code
 *    Drupal.behaviors.behaviorName = {
 *      attach: function (context, settings) {
 *        ...
 *      },
 *      detach: function (context, settings, trigger) {
 *        ...
 *      }
 *    };
 * @endcode
anon’s picture

Status: Active » Needs review
FileSize
2.35 KB

ARGH! Its seems impossible to use the detach functions.

So I tryed to make a fucntion that would recognize slashes in the input value and when a slash was found, it would disable the autocomplete function and so on, But that was also very hard to make good.

My next approach is to create a checkbox, that will toggle autocomplete on and off.
What do you think about this? (See patch)

anon’s picture

Priority: Normal » Major
vitok-dupe’s picture

anon: "What do you think about this?"

Waste of time, it's drupal core bug!

anon’s picture

@vitok: Yes it is, but what you suggest? That external linkin should give big error msg?

caschbre’s picture

I installed the patch and when the checkbox is ticked, I don't get the error.

From a usability perspective it still leaves a high probability that the user is going to start typing w/o selecting the checkbox. Even when I was testing and 'knew' I was supposed to test it, I just started typing and got the error.

Unfortunately I don't know javascript well enough to offer technical suggestions on how to capture the user entering the slash (/). And I'm not sure you could design it (UI wise) to really work around it because the user could still enter the slash at any time.

If the issue is at the core auto-complete level, then maybe we leave this issue open and reduce it to normal and link to a core issue?

vitok-dupe’s picture

Title: Slashes doesnt work with autocomplete (waiting for D7 update to fix this) » Slashes doesnt work with autocomplete
Priority: Normal » Major
Status: Active » Needs review

You can fix this only with patch for drupal core, other ways it's just a waste of time! You write the fix for now, giving people new release, but that happens then drupal core bug will be fixed? You will need to remove your fix and making new release?

Core Taxonomy autocomplete with slash typing giving error.
Core User autocomplete with slash typing giving error.
Core any way autocomplete with slash giving error.
Why you take "Linkit autocomplete slash error" problem personally to yourself, and thinking that it's very bad for Linkit? It's bad for drupal at all!

anon’s picture

Title: Slashes doesnt work with autocomplete » Slashes doesnt work with autocomplete (waiting for D7 update to fix this)
Priority: Major » Normal
Status: Needs review » Active

Ok, We really need a new Linkit release, so Im gonna go with you and vitok.

I will make a section at the project page with "Know problems".

caschbre’s picture

Title: Slashes doesnt work with autocomplete » Slashes doesnt work with autocomplete (waiting for D7 update to fix this)
Priority: Major » Normal
Status: Needs review » Active
caschbre’s picture

Since we have to wait for core D7 to fix the bug, the linkit module has a few options...

1) No Ext Link Checkbox

Problem with this route is users will probably get frustrated with having to use two different wyiswyg buttons... one for internal and one for external.

2) Ext Link Checkbox

This is a workaround and the checkbox could be removed after core is fixed. But there isn't a need to push that out right away. It could wait until another update comes along.

In either case the known issue should be noted. Are there any other options?

anon’s picture

I think your right. Lets wait and see what happening with he core issue.

I made a realse now, 7.x-1.1 is out.
Also added a "Know problems" section at the project page.

betamos’s picture

Status: Active » Postponed

Please change back to active once d7-1.1 is out.

caschbre’s picture

I realize this can't be "fixed" until core is fixed... but was anything put in place to notify the user of the issue in the linkit popup, checkbox, etc.? I know we tossed out a few ideas to help deter users from entering the slashes.

The reason I ask is I'm testing the 7-dev version and forgot about the issue until it happened to me again. I noticed there wasn't anything in the D7 version to deter / notify me of the issue.

anon’s picture

No we didnt do anything, as like you said, we have to wait for the core fix first.

geek-merlin’s picture

sub

caschbre’s picture

The core issue I previously linked to was closed as a duplicate of #93854: Allow autocompletion requests to include slashes which appears to be a very very old issue. ugh.

swentel’s picture

FileSize
850 bytes

Here's a patch for linkit that works with the patch mentioned in #21. If this is committed in core, that patch alone won't be enough to fix it. So you need the core patch and this patch for the ajax error to go away.

anon’s picture

@swentel, Thanks for the patch.

Me and betamos are currently working on a new major version of Linkit (7.x-2.x) and we have some different approch in that version on how we will handle the autocomplete.

Betamos has build a new autocomplete handler so we hope that this issue is going to solve itself with the next major Linkit version.

swentel’s picture

@anon Even than, you'll need the load arguments in the menu normally. Less work to maintain also :) (but that's your choice of course)

betamos’s picture

I can confirm that slashes is working in the 7.x-2.x branch. Since we use urlencode and a get-parameter, it works fine. However, it's good that you addressed this issue again @swentel, because I rembered that I have not tested it without clean URL:s. I wrote a todo for it now.

anon’s picture

Status: Postponed » Closed (won't fix)

When the core issue is solved, this will not be a problem for linkit.
Also, the 7.x-2.x version of Linkit handle this in a different way.

yseki’s picture

Open misc\autocomplete.js

go to line 293
change url: db.uri + '/' + encodeURIComponent(searchString),
to url: db.uri + '/' + encodeURIComponent(searchString.toString().replace('/', '')),

nymo’s picture

#27 worked, core be patched with this fix?

danielb’s picture

There is an alternate solution in a Drupal core issue queue

-      url: db.uri + '/' + encodeURIComponent(searchString),
+      url: db.uri + '/' + Drupal.encodePath(searchString),

#93854: Allow autocompletion requests to include slashes

anon’s picture

Yes, this is exacly the issue.

Tho, in 7.x.-2.x this is solved in another way, see the Linkit project page for more info.