From 41a2cfceedc9db04dc102bd72d5d69dbc3b09693 Mon Sep 17 00:00:00 2001 From: Davide Bongiovanni Date: Tue, 6 Jun 2017 20:35:59 +0200 Subject: [PATCH] Enhanced input checking --- static/script.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/static/script.js b/static/script.js index ad849ac..ca75f3c 100644 --- a/static/script.js +++ b/static/script.js @@ -92,8 +92,8 @@ function save(partID) { var quantity_v = $('#quantity-input').val(); var notes_v = $('#notes-input').val(); var datasheet = $('#datasheet-input')[0].files; - if(! partno_v.match(/^([a-zA-Z0-9]+\s*){1,3}$/g)) { - alert('Invalid part number format. Accepted: '); + if(! partno_v.match(/^([a-zA-Z0-9]{1,20}\s*){1,3}$/g)) { + alert('Invalid part number format. Accepted: '); return; } if(! block_v.match(/^[0-9]+$/g)) {