projects
/
misc
/
kostenrechnung
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
71c8ee6
)
Add support for per-page functions to be called before saving or
author
Joey Schulze
<joey@infodrom.org>
Fri, 12 Mar 2010 14:05:34 +0000
(15:05 +0100)
committer
Joey Schulze
<joey@infodrom.org>
Fri, 12 Mar 2010 14:05:34 +0000
(15:05 +0100)
inserting new records
lib/functions.js
patch
|
blob
|
history
diff --git
a/lib/functions.js
b/lib/functions.js
index
b46c0b8
..
fd65cd4
100644
(file)
--- a/
lib/functions.js
+++ b/
lib/functions.js
@@
-134,6
+134,8
@@
function select_update(id, options, empty)
obj.options[empty+i] = new Option(options[i].text,options[i].id,false,false);
}
obj.options[empty+i] = new Option(options[i].text,options[i].id,false,false);
}
+var pre_save = false;
+var pre_insert = false;
var post_save = function() { grid_update(grid); }
var post_delete = function() { grid_update(grid); }
var post_save = function() { grid_update(grid); }
var post_delete = function() { grid_update(grid); }
@@
-161,6
+163,12
@@
function form_save(obj)
return form_insert(obj);
info('');
return form_insert(obj);
info('');
+
+ if (typeof pre_save == 'function')
+ if (!pre_save())
+ return false;
+
+
ajax_request('save', Form.serialize(obj.form), save_callback);
return false;
}
ajax_request('save', Form.serialize(obj.form), save_callback);
return false;
}
@@
-168,6
+176,11
@@
function form_save(obj)
function form_insert(obj)
{
info('');
function form_insert(obj)
{
info('');
+
+ if (typeof pre_insert == 'function')
+ if (!pre_insert())
+ return false;
+
ajax_request('insert', Form.serialize(obj.form), save_callback);
return false;
}
ajax_request('insert', Form.serialize(obj.form), save_callback);
return false;
}