Added text_input() helper.
authorJanusz Dobrowolski <janusz@frontaccounting.eu>
Fri, 17 Apr 2015 12:54:33 +0000 (14:54 +0200)
committerJanusz Dobrowolski <janusz@frontaccounting.eu>
Sun, 19 Apr 2015 17:46:07 +0000 (19:46 +0200)
includes/ui/ui_input.inc

index ef8b9caccc32ee873c8f040de56fb5a088382088..bdb7e94545bba833171ea38d60b22a969facea16 100644 (file)
@@ -504,6 +504,16 @@ function label_row($label, $value, $params="", $params2="", $leftfill=0, $id=nul
        echo "</tr>\n";
 }
 
+function text_input($name, $value=null, $size='', $max='', $title='', $params='')
+{
+       if ($value === null)
+               $value = get_post($name);
+
+       return "<input $params type=\"text\" name=\"$name\" size=\"$size\" maxlength=\"$max\" value=\"$value\""
+           .($title ? " title='$title'" : '')
+           .">";
+}
+
 //-----------------------------------------------------------------------------------
 
 function text_cells($label, $name, $value=null, $size="", $max="", $title=false, 
@@ -516,11 +526,7 @@ function text_cells($label, $name, $value=null, $size="", $max="", $title=false,
                label_cell($label, $labparams);
        echo "<td>";
 
-       if ($value === null)
-               $value = get_post($name);
-       echo "<input $inparams type=\"text\" name=\"$name\" size=\"$size\" maxlength=\"$max\" value=\"$value\""
-           .($title ? " title='$title'" : '')
-           .">";
+       echo text_input($name, $value, $size, $max, $title, $inparams);
 
        if ($post_label != "")
                echo " " . $post_label;