Focus set to invalid field after submit check fail
[fa-stable.git] / purchasing / allocations / supplier_allocate.php
index e749e0fea4e6a1446af95f6a077b121b793b6f25..2f93c1a9829e6ddee275a8b981af1ba2a144669c 100644 (file)
@@ -16,7 +16,7 @@ $js = "";
 if ($use_popup_windows)
        $js .= get_js_open_window(900, 500);
 
-$js .= get_js_allocate();
+add_js_allocate();
 
 page(_("Allocate Supplier Payment or Credit Note"), false, false, "", $js);
 
@@ -46,6 +46,7 @@ function check_data()
                if (!check_num('amount' . $counter, 0))
                {
                        display_error(_("The entry for one or more amounts is invalid or negative."));
+                       set_focus('amount');
                        return false;
                 }
 
@@ -227,7 +228,7 @@ function edit_allocations_for_transaction($type, $trans_no)
                }
                
         label_row(_("Total Allocated"), number_format2($total_allocated,user_price_dec()),
-               "colspan=6 align=right", "align=right");
+               "colspan=6 align=right", "align=right id='total_allocated'");
         if (-$_SESSION['alloc']->amount - $total_allocated < 0)
         {
                $font1 = "<font color=red>";
@@ -237,11 +238,11 @@ function edit_allocations_for_transaction($type, $trans_no)
                $font1 = $font2 = "";
                $left_to_allocate = price_format(-$_SESSION['alloc']->amount - $total_allocated); 
         label_row(_("Left to Allocate"), $font1 . $left_to_allocate . $font2, "colspan=6 align=right", 
-               "nowrap align=right");
+               "nowrap align=right id='left_to_allocate'");
                end_table();            
 
                hidden('TotalNumberOfAllocs', $counter);
-               hidden('left_to_allocate', $left_to_allocate);
+//             hidden('left_to_allocate', $left_to_allocate);
        echo "<br><center>";
                submit('UpdateDisplay', _("Update"));
                echo "&nbsp;";