diff options
| -rw-r--r-- | static/js/app.js | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/static/js/app.js b/static/js/app.js index 4abf214..7efe1c7 100644 --- a/static/js/app.js +++ b/static/js/app.js @@ -26,6 +26,18 @@ function registerAutosave(id){ // Function to save memo function save(id, manually){ + if ( !$('#Title').val().trim() ){ + swal({ + title: "Title required", + text: "In order to save please enter a title.", + type: "warning", + confirmButtonClass: "btn-danger", + confirmButtonText: "Close", + closeOnConfirm: false, + }); + return; + } + $.ajax({ url: "/api/new", data: $(id).serialize(), @@ -120,6 +132,18 @@ $(document).ready(function(){ }; $('#autosave').click(function() { + if ( !$('#Title').val().trim() ){ + swal({ + title: "Title required", + text: "In order to save please enter a title.", + type: "warning", + confirmButtonClass: "btn-danger", + confirmButtonText: "Close", + closeOnConfirm: false + }); + return; + } + $(this).toggleClass("btn-danger").promise().done(function(){ if ( $(this).html().match(/Enable/) ){ registerAutosave(this); |
