From: Joey Schulze Date: Mon, 8 Mar 2010 22:11:06 +0000 (+0100) Subject: Handle save request as insert when there is no ID X-Git-Tag: 2010-06-02_customer~81 X-Git-Url: https://git.infodrom.org/?p=misc%2Fkostenrechnung;a=commitdiff_plain;h=663ec1379bee03894013c5c6947fe6ac61a2df62 Handle save request as insert when there is no ID --- diff --git a/lib/functions.js b/lib/functions.js index 2de1400..1d7aa0b 100644 --- a/lib/functions.js +++ b/lib/functions.js @@ -135,6 +135,11 @@ function delete_callback(data) function form_save(obj) { + var id = document.getElementById('edit_id'); + + if (!id.value.length) + return form_insert(obj); + info(''); ajax_request('save', Form.serialize(obj.form), save_callback); return false; @@ -150,6 +155,9 @@ function form_insert(obj) function form_delete(obj) { var id = document.getElementById('edit_id'); + + if (!id.value.length) return; + var source = document.getElementById('edit_source'); info(''); var params = 'id='+id.value + '&source='+source.value;