Posted by anon on January 12, 2011 at 4:19pm
9 followers
| Project: | Linkit |
| Version: | 7.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (won't fix) |
Issue Summary
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: []
Comments
#1
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.
#2
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.
#3
Seems that this is drupal core bug, because if typing slash in default tags field, it's giving same error.
#4
So now anon you clear to giving us 1.1 release. And can you also open bug report for drupal core?
#5
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.
#6
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
#7
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)
#8
#9
anon: "What do you think about this?"
Waste of time, it's drupal core bug!
#10
@vitok: Yes it is, but what you suggest? That external linkin should give big error msg?
#11
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?
#12
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!
#13
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".
#14
Here is the issue for core.
#995512: Autocomplete doesn't work with slashes
#15
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?
#16
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.
#17
Please change back to active once d7-1.1 is out.
#18
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.
#19
No we didnt do anything, as like you said, we have to wait for the core fix first.
#20
sub
#21
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.
#22
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.
#23
@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.
#24
@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)
#25
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.
#26
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.
#27
Open misc\autocomplete.js
go to line 293
change
url: db.uri + '/' + encodeURIComponent(searchString),to
url: db.uri + '/' + encodeURIComponent(searchString.toString().replace('/', '')),#28
#27 worked, core be patched with this fix?
#29
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
#30
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.