Use set variable framework
authorJoey Schulze <joey@infodrom.org>
Fri, 5 Mar 2010 10:11:42 +0000 (11:11 +0100)
committerJoey Schulze <joey@infodrom.org>
Fri, 5 Mar 2010 10:11:42 +0000 (11:11 +0100)
masks/overview_kostenstellen.php

index 4773950..8918bc5 100644 (file)
@@ -7,17 +7,10 @@ function select_year_calback(data)
   grid_update(grid);
 }
 
-function select_year(obj)
+function select_year_status(obj, value, html)
 {
-  if (!obj.options[obj.selectedIndex].value.length)
-    val = -1;
-  else
-    val = obj.options[obj.selectedIndex].value;
-
-  ajax_request('setvar','source=overview_kostenstellen&name=year&value='+val,select_year_calback);
-
-  if (obj.options[obj.selectedIndex].value.length)
-    info('Jahr ' + obj.options[obj.selectedIndex].innerHTML + ' ausgewählt');
+  if (value.length)
+    info('Jahr ' + value + ' ausgewählt');
   else
     info('');
 }
@@ -44,7 +37,7 @@ $mask = array(
                                'options' => discover_years(),
                                'default' => 'Jahr wählen',
                                'selected' => $_SESSION['overview_kostenstellen.year'],
-                               'onchange' => 'select_year(this)',
+                               'onchange' => "setvar(this,'year',select_year_calback,select_year_status)",
                                ),
              'variables' => array(
                                   'year' => array(),