From 579c3880568407ad3a97f33800836a9942be869d Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Thu, 7 Jul 2011 11:51:33 +0000 Subject: [PATCH] differenciate in our serverside user-agent detection between Chrome and Safari, and disable html5 form validation for float, as Chrome 12 rejects float values with comma as decimal separator --- etemplate/inc/class.etemplate.inc.php | 5 +++++ phpgwapi/inc/class.html.inc.php | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/etemplate/inc/class.etemplate.inc.php b/etemplate/inc/class.etemplate.inc.php index bf3a3923dc..65b77cc50e 100644 --- a/etemplate/inc/class.etemplate.inc.php +++ b/etemplate/inc/class.etemplate.inc.php @@ -1243,6 +1243,11 @@ class etemplate extends boetemplate // a few html5 options if ((string)$min !== '') $options .= ' min="'.htmlspecialchars($min).'"'; if ((string)$max !== '') $options .= ' max="'.htmlspecialchars($max).'"'; + // disable html5 form validation for float, as Chrome 12 rejects float values with comma as decimal separator + if ($type == 'float' && !$readonly && html::$user_agent == 'chrome' && strpos(self::$form_options,'novalidate') === false) + { + self::$form_options .= ' novalidate="novalidate"'; + } if ($cell_options == '' && !$readonly) { $cell_options = $cell['type'] == 'int' ? 5 : 8; diff --git a/phpgwapi/inc/class.html.inc.php b/phpgwapi/inc/class.html.inc.php index 10f1ffc3f5..5a25532776 100644 --- a/phpgwapi/inc/class.html.inc.php +++ b/phpgwapi/inc/class.html.inc.php @@ -20,7 +20,7 @@ class html { /** - * user-agent: 'firefox', 'msie', 'safari' (incl. iPhone, Chrome), 'opera', 'konqueror', 'mozilla' + * user-agent: 'firefox', 'msie', 'safari' (incl. iPhone), 'chrome', 'opera', 'konqueror', 'mozilla' * @var string */ static $user_agent; @@ -65,7 +65,7 @@ class html if(!preg_match('/compatible; ([a-z]+)[\/ ]+([0-9.]+)/i',$_SERVER['HTTP_USER_AGENT'],$parts)) { preg_match_all('/([a-z]+)\/([0-9.]+)/i',$_SERVER['HTTP_USER_AGENT'],$parts,PREG_SET_ORDER); - $parts = array_pop($parts); + $parts = $parts[2][1] == 'Chrome' ? $parts[2] : array_pop($parts); } list(,self::$user_agent,self::$ua_version) = $parts; if ((self::$user_agent = strtolower(self::$user_agent)) == 'version') self::$user_agent = 'opera';