Permalink
Browse files

Fixes a bug with maxlength and minlength handling in HTMLForm library.

  • Loading branch information...
JB Lebrun
JB Lebrun committed Nov 20, 2018
1 parent 6d95fca commit bf59956529e9423c9d7944495a4a07b204faa224
Showing with 7 additions and 5 deletions.
  1. +7 −5 engine/lib/object/HTMLForm.php.inc
@@ -4,7 +4,7 @@
* @details Engine / Object Library
* @file engine/lib/object/HTMLForm.php.inc
* @author CaMykS Team <camyks.contact@gmail.com>
* @version 1.1.3
* @version 1.1.4
* @date Creation: Jun 2005
* @date Modification: Nov 2018
* @copyright 2005 - 2018 CaMykS Team
@@ -133,8 +133,8 @@ class HTMLForm {
'data' => array(),
'tabIndex' => -1,
'placeholder' => '',
'maxlength' => -1,
'minlength' => -1,
'maxlength' => 0,
'minlength' => 0,
'pattern' => '',
'readonly' => '',
'list' => '',
@@ -1039,6 +1039,8 @@ class HTMLForm {
$params['maxlength'] = 32;
}
/* build input */
$html = '<input type="text"';
$html .= ' value="'.htmlentities($params['default'], ENT_COMPAT, 'UTF-8').'"';
@@ -1495,9 +1497,9 @@ class HTMLForm {
$params['name'] .= '[]';
if ($params['id'] != '')
$html .= ' id="'.$params['id'].'"';
if ($params['maxlength'] > -1)
if ($params['maxlength'] > 0)
$html .= ' maxlength="'.$params['maxlength'].'"';
if ($params['minlength'] > -1)
if ($params['minlength'] > 0)
$html .= ' minlength="'.$params['minlength'].'"';
if ($params['class'] != '')
$html .= ' class="'.$params['class'].'"';

0 comments on commit bf59956

Please sign in to comment.