Added max parameter to textarea*() helpers, added constraints on all memo/comments...
[fa-stable.git] / includes / ui / ui_input.inc
index dbcdee67de47e2568a181bec8cc6d56d9f7e451d..0b59aaaac15cce9fefa937f56d37de597de0cc0a 100644 (file)
@@ -348,7 +348,13 @@ function select_button_cell($name, $value, $title=false)
 
 function check_value($name)
 {
-    return (empty($_POST[$name]) ? 0 : 1);
+       if (is_array($name)) {
+               $ret = array();
+               foreach($name as $key)
+                       $ret[$key] = check_value($key);
+               return $ret;
+       } else
+               return (empty($_POST[$name]) ? 0 : 1);
 }
 
 function checkbox($label, $name, $value=null, $submit_on_change=false, $title=false)
@@ -905,7 +911,7 @@ function small_qty_cells($label, $name, $init=null, $params=null, $post_label=nu
 
 //-----------------------------------------------------------------------------------
 
-function textarea_cells($label, $name, $value, $cols, $rows, $title = null, $params="")
+function textarea_cells($label, $name, $value, $cols, $rows, $max=255, $title = null, $params="")
 {
        global $Ajax;
 
@@ -916,14 +922,15 @@ function textarea_cells($label, $name, $value, $cols, $rows, $title = null, $par
                $value = (!isset($_POST[$name]) ? "" : $_POST[$name]);
        echo "<td><textarea name='$name' cols='$cols' rows='$rows'"
        .($title ? " title='$title'" : '')
+       .($max ? " maxlength=$max" : '')
        .">$value</textarea></td>\n";
        $Ajax->addUpdate($name, $name, $value);
 }
 
-function textarea_row($label, $name, $value, $cols, $rows, $title=null, $params="")
+function textarea_row($label, $name, $value, $cols, $rows, $max=255, $title=null, $params="")
 {
        echo "<tr><td class='label'>$label</td>";
-       textarea_cells(null, $name, $value, $cols, $rows, $title, $params);
+       textarea_cells(null, $name, $value, $cols, $rows, $max, $title, $params);
        echo "</tr>\n";
 }
 
@@ -1005,7 +1012,7 @@ function bank_balance_row($bank_acc, $parms='')
        $bal = get_balance_before_for_bank_account($bank_acc, $to);
        label_row( _("Bank Balance:"),
                "<a target='_blank' " . ($bal<0 ? 'class="redfg"' : '')
-               ."href='$path_to_root/gl/inquiry/bank_inquiry.php?bank_account=".$bank_acc."&no_header=1"."'"           
+               ."href='$path_to_root/gl/inquiry/bank_inquiry.php?bank_account=".$bank_acc."'"
                ." onclick=\"javascript:openWindow(this.href,this.target); return false;\" >&nbsp;"
                . price_format($bal)
                ."</a>", $parms);