Bug submitting forms in FA 2.4.x when checkbox field not changed. Fixed
[fa-stable.git] / includes / ui / ui_input.inc
index feb136ffdfd64600bec9a97aa1abf9a9374c71fb..2a4d75fd308c154c6475b84a440807bd4ff9af9f 100644 (file)
@@ -287,7 +287,7 @@ function set_icon($icon, $title=false)
        global $path_to_root;
        if (basename($icon) === $icon) // standard icons does not contain path separator
                $icon = "$path_to_root/themes/".user_theme()."/images/$icon";
-       return "<img src='$icon' width='12' height='12' border='0'".($title ? " title='$title'" : "")." >\n";   
+       return "<img src='$icon' style='vertical-align:middle;width:12px;height:12px;border:0;'".($title ? " title='$title'" : "")." >\n";      
 }
 
 function button($name, $value, $title=false, $icon=false,  $aspect='')
@@ -347,7 +347,7 @@ function select_button_cell($name, $value, $title=false)
 
 function check_value($name)
 {
-       if (!isset($_POST[$name]) || $_POST[$name]=='')
+    if (!isset($_POST[$name]) || ($_POST[$name]+0) === 0)
                return 0;
        return 1;
 }
@@ -653,7 +653,7 @@ function date_cells($label, $name, $title = null, $check=null, $inc_days=0,
                $calc_image = (file_exists("$path_to_root/themes/".user_theme()."/images/cal.gif")) ? 
                        "$path_to_root/themes/".user_theme()."/images/cal.gif" : "$path_to_root/themes/default/images/cal.gif";
                $post_label = "<a tabindex='-1' href=\"javascript:date_picker(document.getElementsByName('$name')[0]);\">"
-               . "     <img src='$calc_image' width='16' height='16' border='0' alt='"._('Click Here to Pick up the date')."'></a>\n";
+               . "     <img src='$calc_image' style='vertical-align:middle;padding-bottom:4px;width:16px;height:16px;border:0;' alt='"._('Click Here to Pick up the date')."'></a>\n";
        }       
        else
                $post_label = "";
@@ -734,7 +734,7 @@ function ref_cells($label, $name, $title=null, $init=null, $params=null, $submit
                        {
                                $_POST[$name] = $init;
                        } else {
-                               $_POST[$name] = $Refs->get_next($type, $_POST[$name.'_list'], $context); // set default
+                               $_POST[$name] = $Refs->get_next($type, $_POST[$name.'_list'], $context);
                        }
                        $Ajax->addUpdate(true, $name, $_POST[$name]);
                }
@@ -1012,3 +1012,12 @@ function bank_balance_row($bank_acc, $parms='')
                ."</a>", $parms);
 }
 
+function ahref($label, $href, $target="", $onclick="") {
+  echo "<a href='$href' target='$target' onclick='$onclick'>$label</a>";
+}
+
+function ahref_cell($label, $href, $target="", $onclick="") {
+  echo "<td align='center'>&nbsp;&nbsp;";
+  ahref($label, $href, $target, $onclick);
+  echo "&nbsp;&nbsp;</td>";
+}