[PEAR-BUG] Bug #18530 [Com]: Autocomplete broken on Firefox 4
[email protected] ("shadesofgraylin")
| Newsgroups | php.pear.bugs |
|---|---|
| Message-ID | <[email protected]> |
Edit report at http://pear.php.net/bugs/bug.php?id=18530&edit=1
ID: 18530
Comment by: shadesofgraylin
Reported By: graylin dot kim at gmail dot com
Summary: Autocomplete broken on Firefox 4
Status: Analyzed
Type: Bug
Package: HTML_QuickForm
Operating System: linux
Package Version: 3.2.12
PHP Version: 5.2.10
New Comment:
I tried submitting via `Add patch` repeatedly but never received a
confirmation email. Since the patch is simple enough, I'm trying again
here.
You can patch this issue by scoping the autocomplete function to the
window with the following patch.
Index: QuickForm/autocomplete.php
===================================================================
--- QuickForm/autocomplete.php (revision 312209)
+++ QuickForm/autocomplete.php (working copy)
@@ -124,7 +124,7 @@
$arrayName = str_replace(array('[', ']'), array('__', ''),
$this->getName()) . '_values';
$this->updateAttributes(array(
- 'onkeypress' => 'return autocomplete(this, event, ' .
$arrayName . ');'
+ 'onkeypress' => 'return window.autocomplete(this, event, '
. $arrayName . ');'
));
if ($this->_flagFrozen) {
$js = '';
Previous Comments:
------------------------------------------------------------------------
[2011-05-12 17:47:43] avb
<div id="changeset">
<span class="removed">-Status: Open</span>
<span class="added">+Status: Analyzed</span>
</div>Probably conflicts with autocomplete attribute of HTML5:
http://www.whatwg.org/specs/web-apps/current-work/multipage/common-input-element-attributes.html#the-autocomplete-attribute
Dunno why js functions of the element were not namespaced / prefixed.
------------------------------------------------------------------------
[2011-05-12 16:29:57] ednawig
Description:
------------
Autocomplete does not work on FF4. The console reports
"autocomplete is not a function"
Test script:
---------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head></head>
<body>
<h3>Autocomplete</h3>
<?php
$fruits = array("Bananas","Grapes","Oranges");
require_once 'HTML/QuickForm.php';
$form = new HTML_QuickForm();
// add auto-complete input field
$ac0 = $form->addElement('autocomplete', 'fruit','Fruit:',$fruits);
$form->addElement('submit', null, 'Submit');
// print submitted values
// render and display the form
if ($form->validate()) {
$form->freeze();
print_r($_POST);
} else {
$form->display();
}
?>
</body>
</html>
Expected result:
----------------
Expected: type the letter 'b' in the box, and it should complete to
'Bananas'. This is what I get on FF3 and other browsers (chrome,
safari, IE)
Actual result:
--------------
FF4 does not complete and the Web Developer console displays
an "autocomplete is not a function" error
------------------------------------------------------------------------
--
Edit this bug report at http://pear.php.net/bugs/bug.php?id=18530&edit=1