From 38c3e52ddee05cfd075d99641b663d8c11510947 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Sat, 30 Jul 2011 08:31:08 +0000 Subject: [PATCH] default step="any" for float, as not setting it limits value to integer as step defaults to 1 in html5! --- etemplate/inc/class.etemplate.inc.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/etemplate/inc/class.etemplate.inc.php b/etemplate/inc/class.etemplate.inc.php index fe3be11d8b..9b06cfdc3d 100644 --- a/etemplate/inc/class.etemplate.inc.php +++ b/etemplate/inc/class.etemplate.inc.php @@ -1240,16 +1240,16 @@ class etemplate extends boetemplate if ($activate_links) $value = html::activate_links($value); $html .= $value; break; - case 'int': // size: [min],[max],[len],[precission/sprint format] + case 'int': // size: [min],[max],[len],[precision/sprint format],[step] case 'float': - list($min,$max,$cell_options,$pre) = explode(',',$cell_options); + list($min,$max,$cell_options,$pre,$step) = explode(',',$cell_options); // 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) + // default step="any" for float, as not setting it limits value to integer as step defaults to 1 in html5! + if (is_numeric($step) || $type == 'float') { - self::$form_options .= ' novalidate="novalidate"'; + $options .= ' step="'.(is_numeric($step)?$step:'any').'"'; } if ($cell_options == '' && !$readonly) {