mirror of
https://github.com/ZoneMinder/zoneminder.git
synced 2025-12-23 22:37:53 -05:00
19 lines
561 B
JavaScript
19 lines
561 B
JavaScript
function validateForm(form) {
|
|
var errors = [];
|
|
if (!form.elements['newAIClass[ModelId]'].value) {
|
|
errors[errors.length] = 'You must select a model';
|
|
}
|
|
if (!form.elements['newAIClass[ClassName]'].value) {
|
|
errors[errors.length] = 'You must supply a class name';
|
|
}
|
|
var classIndexValue = form.elements['newAIClass[ClassIndex]'].value;
|
|
if (!classIndexValue && classIndexValue !== '0') {
|
|
errors[errors.length] = 'You must supply a class index';
|
|
}
|
|
if (errors.length) {
|
|
alert(errors.join("\n"));
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|