From c5b84f1d2b5c467dddd2703ce8c82e5236819ef8 Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Mon, 13 Jul 2015 12:40:28 +0200 Subject: [PATCH] Added the 'required' attribute to the input text and input text password through a function parameter (cherry picked from commit 4f2c35ac63dc2d922607f7cb915b065a9cf77446) --- pandora_console/include/functions_html.php | 24 ++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index 7113d564fb..df046ac2fd 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -772,7 +772,7 @@ function html_print_input_text_extended ($name, $value, $id, $alt, $size, $maxle "title", "xml:lang", "onfocus", "onblur", "onselect", "onchange", "onclick", "ondblclick", "onmousedown", "onmouseup", "onmouseover", "onmousemove", "onmouseout", - "onkeypress", "onkeydown", "onkeyup"); + "onkeypress", "onkeydown", "onkeyup", "required"); $output = ' 'required'); + + return html_print_input_text_extended ($name, $value, 'password-'.$name, $alt, $size, $maxlength, $disabled, '', $attr, $return, true); } /** @@ -932,14 +937,17 @@ function html_print_input_password ($name, $value, $alt = '', $size = 50, $maxle * * @return string HTML code if return parameter is true. */ -function html_print_input_text ($name, $value, $alt = '', $size = 50, $maxlength = 255, $return = false, $disabled = false) { +function html_print_input_text ($name, $value, $alt = '', $size = 50, $maxlength = 255, $return = false, $disabled = false, $required = false) { if ($maxlength == 0) $maxlength = 255; if ($size == 0) $size = 10; - return html_print_input_text_extended ($name, $value, 'text-'.$name, $alt, $size, $maxlength, $disabled, '', '', $return); + if ($required) + $attr = array('required' => 'required'); + + return html_print_input_text_extended ($name, $value, 'text-'.$name, $alt, $size, $maxlength, $disabled, '', $attr, $return); } /**