Enhanced input checking

pull/3/head
Davide Bongiovanni 8 years ago
parent c8dd7d9327
commit 41a2cfceed

@ -92,8 +92,8 @@ function save(partID) {
var quantity_v = $('#quantity-input').val(); var quantity_v = $('#quantity-input').val();
var notes_v = $('#notes-input').val(); var notes_v = $('#notes-input').val();
var datasheet = $('#datasheet-input')[0].files; var datasheet = $('#datasheet-input')[0].files;
if(! partno_v.match(/^([a-zA-Z0-9]+\s*){1,3}$/g)) { if(! partno_v.match(/^([a-zA-Z0-9]{1,20}\s*){1,3}$/g)) {
alert('Invalid part number format. Accepted: <Part-number-line-1> <Part-number-line-2> <Part-number-line-3>'); alert('Invalid part number format. Accepted: <Part-number-line-1(max 20 chars)> <Part-number-line-2(max 20 chars)> <Part-number-line-3(max 20 chars)>');
return; return;
} }
if(! block_v.match(/^[0-9]+$/g)) { if(! block_v.match(/^[0-9]+$/g)) {

Loading…
Cancel
Save