From c13a8f677dd0e2fe5e3ee260d51e95665d71ba36 Mon Sep 17 00:00:00 2001 From: James Taylor Date: Sun, 19 Jan 2020 14:29:50 -0800 Subject: local playlists: Display error message if no videos are selected or no playlist is chosen when using "add to playlist" See #4 --- youtube/templates/base.html | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'youtube') diff --git a/youtube/templates/base.html b/youtube/templates/base.html index 554e116..4ff83c5 100644 --- a/youtube/templates/base.html +++ b/youtube/templates/base.html @@ -155,6 +155,16 @@ var XHR = new XMLHttpRequest(); var FD = new FormData(playlistAddForm); + if(FD.getAll('video_info_list').length === 0){ + displayMessage('Error: No videos selected', true); + return; + } + + if(FD.get('playlist_name') === ""){ + displayMessage('Error: No playlist selected', true); + return; + } + // https://stackoverflow.com/questions/48322876/formdata-doesnt-include-value-of-buttons FD.append('action', 'add'); -- cgit v1.2.3