/* * funkce pro praci s formularem */ var add_comment_errors = { 'errors': 'There are following mistakes in the form, please fix them:', 'missing-subject': 'Comment Subject not specified', 'missing-text': 'Comment Text not specified' }; /* * kontrola zakladnich povinnych prvku formulare */ function checkAddCommentForm() { var ok = true; var error = ""; // povinna pole var reqs = ['subject', 'text']; for(i = 0; i < reqs.length; i++) { var req = reqs[i]; var value = $F('add-comment-' + req).trim(); if(value == '') { ok = false; error += '\n' + add_comment_errors['missing-' + req]; } } if(! ok) { alert(add_comment_errors['errors'] + error); return false; } return true; }