function check_search() { var searchField = document.getElementById('search'); if (!searchField) { return false; } if (searchField.value.length < 1) { alert('Lūdzu ievadiet meklējamo vārdu'); return false; } return true; } function check_poll() { var poolcontent = document.getElementById('poolcontent'); if(!poolcontent) { return false; } var inputFields = poolcontent.getElementsByTagName('INPUT'); objTotal = inputFields.length; for (i = 0; i < objTotal; i++) { if (inputFields[i].checked) { document.poll_form.submit(); return true; } } alert('Lūdzu izvēlaties vienu variantu'); return false; }