FormValidator: Replace float type with number and step = any

pull/3890/head
Julio Montoya 4 years ago
parent d4b6953f94
commit 7a35aee679
  1. 11
      public/main/inc/lib/formvalidator/Element/FloatNumber.php
  2. 6
      public/main/inc/lib/formvalidator/Element/Number.php

@ -1,12 +1,11 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Float element.
*
* Accepts values like 3.1415 and 3,1415 (its processed and converted to 3.1415)
*
* Class Float
*/
class FloatNumber extends HTML_QuickForm_text
{
@ -21,12 +20,13 @@ class FloatNumber extends HTML_QuickForm_text
$attributes['id'] = $elementName;
}
$attributes['type'] = 'float';
$attributes['type'] = 'number';
$attributes['class'] = 'form-control';
$attributes['step'] = 'any';
parent::__construct($elementName, $elementLabel, $attributes);
$this->_appendName = true;
$this->setType('float');
$this->setType('number');
}
/**
@ -48,9 +48,8 @@ class FloatNumber extends HTML_QuickForm_text
public function getValue()
{
$value = $this->getAttribute('value');
$value = api_float_val($value);
return $value;
return api_float_val($value);
}
/**

@ -1,11 +1,7 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Number element.
*
* Class Number
*/
class Number extends HTML_QuickForm_text
{
/**

Loading…
Cancel
Save