Fixed hidden fields support for ajax driven divs.
authorJanusz Dobrowolski <janusz@frontaccounting.eu>
Sat, 4 Apr 2015 08:42:22 +0000 (10:42 +0200)
committerJanusz Dobrowolski <janusz@frontaccounting.eu>
Sat, 4 Apr 2015 08:43:44 +0000 (10:43 +0200)
includes/ui/ui_controls.inc

index c6a0dd4d90d78014468b16957c726798fd30cb64..515cf999322cd0adabcdc3169b49e0086c692b87 100644 (file)
@@ -56,7 +56,8 @@ function output_hidden()
 {
        global $hidden_fields;
 
-       echo implode('', $hidden_fields);
+       if (is_array($hidden_fields))
+               echo implode('', $hidden_fields);
        $hidden_fields = array();
 }
 //---------------------------------------------------------------------------------
@@ -123,6 +124,7 @@ function table_section($number=1, $width=false)
        if ($number > 1)
        {
                echo "</table>\n";
+               output_hidden();
                $width = ($width ? "width='$width'" : "");
                //echo "</td><td class='tableseparator' $width>\n"; // outer table
                echo "</td><td style='border-left:1px solid #cccccc;' $width>\n"; // outer table
@@ -133,7 +135,10 @@ function table_section($number=1, $width=false)
 function end_outer_table($breaks=0, $close_table=true)
 {
        if ($close_table)
+       {
                echo "</table>\n";
+               output_hidden();
+       }
        echo "</td></tr>\n";
        end_table($breaks);
 }
@@ -388,13 +393,14 @@ function div_end()
 {
     global $ajax_divs, $Ajax;
 
+       output_hidden();
     if (count($ajax_divs))
     {
                $div = array_pop($ajax_divs);
                if ($div[1] !== null)
                        $Ajax->addUpdate($div[1], $div[0], ob_get_flush());
-               echo "</div>";
     }
+       echo "</div>";
 }
 
 //-----------------------------------------------------------------------------
@@ -442,6 +448,7 @@ function tabbed_content_start($name, $tabs, $dft='') {
 }
 
 function tabbed_content_end() {
+       output_hidden();
        echo "</div>"; // content box (don't change to div_end() unless div_start() is used above)
        div_end(); // tabs widget
 }