заранее спасибо за ответ на вопрос.
Цель моей формы (как и многих других подобных форм) - проверить, что
в зависимости от того, все ли проверки в порядке, отображать предупреждение с сообщением.
бутстрап:
<form>
<div class = "form-group">
<label for = "exampleTextarea">Course/Lecturer feedback</label>
<textarea class = "form-control" id = "textArea" rows = "3" placeholder = "Please enter your feedback in this field. Your opinion matters and helps us to provide you with better serivce."></textarea>
</div>
<div class = "form-group">
<label for = "exampleInputEmail1">Please enter your email address</label>
<input type = "email" class = "form-control" id = "emailAddress" aria-describedby = "emailHelp" placeholder = "Enter email">
<small id = "emailHelp" class = "form-text text-muted">We'll never share your email with anyone else.</small>
</div>
<div class = "form-group">
<label for = "exampleInputPassword1">Please enter your password</label>
<input type = "password" class = "form-control" id = "password" placeholder = "Password">
</div>
<button type = "submit" class = "btn btn-primary" onclick = "submitData()">Submit</button>
</form>
javascript
//comment validation function
function textFieldValidate(textField){
var txtln = "";
if (txtln != = "")
return pattern.test(textField);
}
//email validation function
function isValidEmailAddress(emailAddress) {
var pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);
return pattern.test(emailAddress);
}
//password validation function
// at least one number, one lowercase and one uppercase letter
// at least six characters
function passwordValidate(password){
var pw = new RegExp (/(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{6,}/);
return pw.test(password);
}
function submitData(){
//retrieve the values
if (textFieldValidate(textField) && isValidEmailAddress(emailAddress) && passwordValidate(password)){
//send post request
alert("Thank you for your feedback! We have sent this to KGB and you should expect a call any moment now...");
}else{
//display error message
alert("Unfortunately information that you have entered was incorrect, please check the info and and resubmit");
return;
}
}
сейчас я получаю то, что моя страница обновляется и ничего не происходит.



![Безумие обратных вызовов в javascript [JS]](https://i.imgur.com/WsjO6zJb.png)


Хорошо, похоже, проблема была в идентификаторе в html, который назывался textArea, а в функции я назвал его textField.
Теперь ... другая проблема в том, что на самом деле он ничего не проверяет. Просто всплывающее окно появляется ...