X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/pie.php?a=blobdiff_plain;f=includes%2Fhtmlform%2Ffields%2FHTMLTextField.php;h=56589b054c6c9e19a0dff2e1c1c6084b502df018;hb=e50f14a47fdc98c024bbcaca341453a5091f11bb;hp=b51182a2da9a5c29549203b29885f3c2731e1822;hpb=f506a05aaa035b96537b33244b0f18b093048e97;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/htmlform/fields/HTMLTextField.php b/includes/htmlform/fields/HTMLTextField.php index b51182a2da..56589b054c 100644 --- a/includes/htmlform/fields/HTMLTextField.php +++ b/includes/htmlform/fields/HTMLTextField.php @@ -85,18 +85,19 @@ class HTMLTextField extends HTMLFormField { 'type', 'min', 'max', - 'pattern', - 'title', 'step', - 'list', + 'title', 'maxlength', 'tabindex', 'disabled', 'required', 'autofocus', - 'multiple', 'readonly', 'autocomplete', + // Only used in HTML mode: + 'pattern', + 'list', + 'multiple', ]; $attribs += $this->getAttributes( $allowedParams ); @@ -117,6 +118,7 @@ class HTMLTextField extends HTMLFormField { switch ( $this->mParams['type'] ) { case 'int': $type = 'number'; + $attribs['step'] = 1; break; case 'float': $type = 'number'; @@ -129,6 +131,9 @@ class HTMLTextField extends HTMLFormField { case 'url': $type = $this->mParams['type']; break; + case 'textwithbutton': + $type = $this->mParams['inputtype'] ?? 'text'; + break; } } @@ -152,17 +157,22 @@ class HTMLTextField extends HTMLFormField { # @todo Enforce pattern, step, required, readonly on the server side as # well $allowedParams = [ + 'type', + 'min', + 'max', + 'step', + 'title', + 'maxlength', + 'tabindex', + 'disabled', + 'required', 'autofocus', + 'readonly', + 'autocomplete', + // Only used in OOUI mode: 'autosize', - 'disabled', 'flags', 'indicator', - 'maxlength', - 'readonly', - 'required', - 'tabindex', - 'type', - 'autocomplete', ]; $attribs += OOUI\Element::configFromHtmlAttributes( @@ -181,6 +191,9 @@ class HTMLTextField extends HTMLFormField { } $type = $this->getType( $attribs ); + if ( isset( $attribs['step'] ) && $attribs['step'] === 'any' ) { + $attribs['step'] = null; + } return $this->getInputWidget( [ 'id' => $this->mID,