#4536 autocomplete = off by default

This commit is contained in:
Daniel Maya 2021-02-01 13:54:57 +01:00
parent 897064183c
commit 6a9587bff8
1 changed files with 12 additions and 8 deletions

View File

@ -2095,7 +2095,7 @@ function html_print_input_text_extended(
'list',
];
$output = '<input '.($password ? 'type="password" autocomplete="'.$autocomplete.'" ' : 'type="text" ');
$output = '<input '.($password ? 'type="password" autocomplete="'.$autocomplete.'" ' : 'type="text" autocomplete="'.$autocomplete.'"');
if ($readonly && (!is_array($attributes) || !array_key_exists('readonly', $attributes))) {
$output .= 'readonly="readonly" ';
@ -2362,7 +2362,7 @@ function html_print_input_text(
$function='',
$class='',
$onChange='',
$autocomplete='',
$autocomplete='off',
$autofocus=false,
$onKeyDown='',
$formTo='',
@ -2401,10 +2401,6 @@ function html_print_input_text(
$attr['onkeyup'] = $onKeyUp;
}
if ($autocomplete !== '') {
$attr['autocomplete'] = $autocomplete;
}
if ($autofocus === true) {
$attr['autofocus'] = $autofocus;
}
@ -2430,7 +2426,7 @@ function html_print_input_text(
$return,
false,
$function,
'off',
$autocomplete,
$disabled
);
}
@ -2502,6 +2498,10 @@ function html_print_input_email(array $settings):string
$settings['size'] = 255;
}
if (isset($settings['autocomplete']) === false) {
$settings['autocomplete'] = 'off';
}
foreach ($settings as $attribute => $attr_value) {
// Check valid attribute.
if (in_array($attribute, $valid_attrs) === false) {
@ -2581,6 +2581,10 @@ function html_print_input_number(array $settings):string
$settings['maxlength'] = 255;
}
if (isset($settings['autocomplete']) === false) {
$settings['autocomplete'] = 'off';
}
foreach ($settings as $attribute => $attr_value) {
// Check valid attribute.
if (in_array($attribute, $valid_attrs) === false) {
@ -4357,7 +4361,7 @@ function html_print_input($data, $wrapper='div', $input_only=false)
((isset($data['function']) === true) ? $data['function'] : ''),
((isset($data['class']) === true) ? $data['class'] : ''),
((isset($data['onChange']) === true) ? $data['onChange'] : ''),
((isset($data['autocomplete']) === true) ? $data['autocomplete'] : ''),
((isset($data['autocomplete']) === true) ? $data['autocomplete'] : 'off'),
((isset($data['autofocus']) === true) ? $data['autofocus'] : false),
((isset($data['onKeyDown']) === true) ? $data['onKeyDown'] : ''),
((isset($data['form']) === true) ? $data['form'] : ''),