| Project: | Drupal core |
| Version: | 6.x-dev |
| Component: | javascript |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs review |
| Issue tags: | needs backport to D6, needs backport to D7 |
Issue Summary
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.
| Attachment | Size | Status | Test result | Operations |
|---|---|---|---|---|
| autocomplete.js_.diff | 439 bytes | Idle | 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 details | Re-test |
Comments
#1
That would be the best way to fix it, need to be fixed in D8 first.
#2
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)
#3
There is no tricks with the readonly value, you don't need to go through jQuery to get it.
#4
Indeed.
#5
Thanks :)
#6
Committed to 8.x. Thanks!
Moving to 7.x.
#7
#8
re-rolled to the 7.x trivially
#9
Wait. I'm confused. Which patch is for 7.x?
#10
Both. One of them only fixes the logical flaw only, the other one fixes some core beauty issue as well.
#11
Committed to 7.x - thanks! http://drupalcode.org/project/drupal.git/commit/41f11d4
#12
Actually, I guess this is an issue in D6 too.
#13