If I enable FCK 5.x-2.1beta2 on my Drupal 5.6 site, my autocomplete text fields act weird - hitting return on an option doesn't select that option, the way it should; it reloads the page, leaving behind the partial text.

Steps to reproduce:
I edit a node, and type text into a CCK node reference field. The autocomplete wheel does its spinny thing, and I'm presented with options matching my string. I select an option with the arrow keys, and hit return. Instead of the option populating the node reference field (e.g., "My Awesome Node [nid:NID]"), I get just partial text I had originally typed in ("My Aweso").

If I click the mouse on an autocomplete option, all is good (behaves as expected).

If I disable the FCK module, all is good (return works).

Does FCK have some event listener that's hijacking my autocomplete?

Comments

wwalc’s picture

Hi,

Thanks for your report.
I need more info to reproduce this issue.
Actually, I need to know how did you set up your autocomplete text field to be able to observer this problem.
Let me know what modules I need to install, how should I set up all this things.

bcn’s picture

Hi,
I have the same problem as original poster but I'm using 5.x-2.x-dev.

Here is the setup.
Enable FCKEditor (5.x-2.x-dev) and core Taxonomy modules.
Create a new vocabulary, enable it for some content type (eg 'page'), enable (the checkboxes for) 'free tagging' and 'multiple select'.
Create a couple of terms in this new vocabulary.
Add a new node (whatever kind you enabled your free tagging vocabulary for).
Enter some terms in the autocomplete, and when you click enter, the page attempts to submit.

The normal behavior (ie without FCKEditor) is that when you click enter to select a term from the autocomplete, the term is selected and the cursor focus remains in the Taxonomy textbox.

Let me know if you have any questions.

bcn’s picture

Version: 5.x-2.1-beta2 » 5.x-2.x-dev
internal’s picture

Priority: Normal » Critical

Same issue found. This made autocomplete field useless in firefox2, ie6 is fine. The enter key trigger form submission. I think it has some connection with http://drupal.org/node/248146. Hope be fixed soon.

wwalc’s picture

Assigned: Unassigned » wwalc
Artur Formella’s picture

Hi,
I think I found. fckeditor.utils.js uses .onsubmit so $(...).submit(...) which is in Autocomplete may not fire.
That's why autocompleteSubmit can't stop submit and don't put the currently highlighted suggestion when enter was clicked and autocomplete is visible.

Fast solution for 5.x-2.x-dev:

-OPEN fckeditor.utils.js
-FIND

	editorInstance.LinkedField.form.onsubmit = function() {
		for( var i = 0 ; i < fckLaunchedJsId.length ; i++ ) {
			if ( document.getElementById( fckLaunchedTextareaId[i] ).style.display == 'none' )
			document.getElementById( fckLaunchedTextareaId[i] ).value = FCKeditorAPI.GetInstance( fckLaunchedJsId[i] ).GetXHTML() ;
		}
	}

-REPLACE WITH

	$(editorInstance.LinkedField.form).submit(function() {
		for( var i = 0 ; i < fckLaunchedJsId.length ; i++ ) {
			if ( document.getElementById( fckLaunchedTextareaId[i] ).style.display == 'none' )
			document.getElementById( fckLaunchedTextareaId[i] ).value = FCKeditorAPI.GetInstance( fckLaunchedJsId[i] ).GetXHTML() ;
		}
	});

Try and let me know if it works.

wwalc’s picture

Status: Active » Fixed

Sounds like a way to go, fixed in CVS.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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

wwalc’s picture

@arczif: as we agreed in our discussion on skype, please apply for a CVS account to become a co-maintainer of the FCKeditor module.