check-form.js 675 B

12345678910111213141516171819
  1. function checkFields() {
  2. const name = document.querySelector('input[name="name"]').value;
  3. const surname = document.querySelector('input[name="surname"]').value;
  4. const phone = document.querySelector('input[name="phone"]').value;
  5. const submitButton = document.querySelector('input[name="btn-input"]');
  6. if (name && surname && phone) {
  7. submitButton.disabled = false;
  8. } else {
  9. submitButton.disabled = true;
  10. }
  11. }
  12. function submitForm() {
  13. const submitButton = document.querySelector('input[type="submit"]');
  14. if (!submitButton.disabled) {
  15. window.location.href = '#openModalMessage';
  16. window.location.reload();
  17. }
  18. }