From 4c785339769131a8953268a57cf9b22e36cde2b9 Mon Sep 17 00:00:00 2001 From: Davide Bongiovanni Date: Sun, 11 Nov 2018 22:30:27 +0100 Subject: [PATCH] Added part number empty check --- parts/static/script.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/parts/static/script.js b/parts/static/script.js index b8d527a..c47d389 100644 --- a/parts/static/script.js +++ b/parts/static/script.js @@ -59,8 +59,16 @@ function save(partID) { var partno_v = $('table#details tr#partno td input').val(); var description_v = $('table#details tr#description td input').val(); var datasheet = $('table#details tr#datasheet td input')[0].files; + if(partno_v.length == 0){ + alert('Please enter a part number.'); + return; + } if(description_v.length > 200) { - alert('Description too long (max 200 characters).') + alert('Description too long (max 200 characters).'); + return; + } + if(description_v.length == 0) { + alert('Please enter a description.'); return; } var data = new FormData();