If you have a readonly textfield with an autocomplete path, the autocomplete request fires when the user places the cursor in the field and presses any key, even though the textfield is readonly.

The use case for this is to have an autocomplete textfield that you want to enable through some other means (checkbox or other field filled in beforehand). In that case, you don't want the autocomplete to fire until the field is actually writeable.

I have attached an SVN patch with the hack that we will include on our platform, but since it uses jQuery() directly in the autocomplete's prototype context, I really don't think it is the best solution - but it's the best that I could come up with at that point in the code - I could perhaps have done something within the populatePopup() method itself, but I feel that it belongs with the check for input.value.length > 0

I would love it, if someone better at javascript/prototype/autocomplete could come up with a better solution.

Files: 
CommentFileSizeAuthor
#13 1631164-autocomplete_ro-6.x-13.patch500 bytesAron Novak
PASSED: [[SimpleTest]]: [MySQL] 190 pass(es).
[ View ]
#8 1631164_autocomplete_ro-8-only-condition.patch436 bytesAron Novak
PASSED: [[SimpleTest]]: [MySQL] 39,252 pass(es).
[ View ]
#8 1631164_autocomplete_ro-8.patch501 bytesAron Novak
PASSED: [[SimpleTest]]: [MySQL] 39,237 pass(es).
[ View ]
#4 1631164_autocomplete_ro-4.patch437 bytesAron Novak
PASSED: [[SimpleTest]]: [MySQL] 36,850 pass(es).
[ View ]
#2 1631164_autocomplete_ro-2.patch453 bytesAron Novak
PASSED: [[SimpleTest]]: [MySQL] 36,847 pass(es).
[ View ]
autocomplete.js_.diff439 bytesMithrandir
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch autocomplete.js_.diff. Unable to apply patch. See the log in the details link for more information.
[ View ]

Comments

Version:7.14» 8.x-dev
Component:ajax system» javascript
Priority:Minor» Normal

That would be the best way to fix it, need to be fixed in D8 first.

Status:Active» Needs review
StatusFileSize
new453 bytes
PASSED: [[SimpleTest]]: [MySQL] 36,847 pass(es).
[ View ]

Btw. it seems some browsers already implement this behaviour that they do not fire events when the field is read-only (in Opera, it seems it's like that, for example)

There is no tricks with the readonly value, you don't need to go through jQuery to get it.

StatusFileSize
new437 bytes
PASSED: [[SimpleTest]]: [MySQL] 36,850 pass(es).
[ View ]

Indeed.

Status:Needs review» Reviewed & tested by the community
Issue tags:+needs backport to D7

Thanks :)

Version:8.x-dev» 7.x-dev

Committed to 8.x. Thanks!

Moving to 7.x.

Status:Reviewed & tested by the community» Needs work

Status:Needs work» Reviewed & tested by the community
StatusFileSize
new501 bytes
PASSED: [[SimpleTest]]: [MySQL] 39,237 pass(es).
[ View ]
new436 bytes
PASSED: [[SimpleTest]]: [MySQL] 39,252 pass(es).
[ View ]

re-rolled to the 7.x trivially

Wait. I'm confused. Which patch is for 7.x?

Both. One of them only fixes the logical flaw only, the other one fixes some core beauty issue as well.

Status:Reviewed & tested by the community» Fixed

Version:7.x-dev» 6.x-dev
Status:Fixed» Patch (to be ported)
Issue tags:+needs backport to D6

Actually, I guess this is an issue in D6 too.

Status:Patch (to be ported)» Needs review
StatusFileSize
new500 bytes
PASSED: [[SimpleTest]]: [MySQL] 190 pass(es).
[ View ]