Revision: 508
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=508&view=rev
Author: matijsdejong
Date: 2012-02-22 19:20:42 +0000 (Wed, 22 Feb 2012)
Log Message:
-----------
Prevented a JavaScript error.
Modified Paths:
--------------
trunk/library/classes/MUtil/Form/Decorator/AutoFocus.php
Modified: trunk/library/classes/MUtil/Form/Decorator/AutoFocus.php
===================================================================
--- trunk/library/classes/MUtil/Form/Decorator/AutoFocus.php 2012-02-22 08:27:47 UTC (rev 507)
+++ trunk/library/classes/MUtil/Form/Decorator/AutoFocus.php 2012-02-22 19:20:42 UTC (rev 508)
@@ -92,7 +92,7 @@
if (($view !== null) && ($focus !== null)) {
// Use try {} around e.select as nog all elements have a select() function
- $script = "e = document.getElementById('$focus'); if (e) {e.focus(); try { e.select(); } catch (ex) {}}";
+ $script = "e = document.getElementById('$focus'); if (e) {e.focus(); try { if (e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement) {e.select();} } catch (ex) {}}";
$view->inlineScript()->appendScript($script);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|