So the issue I seem to having is a bit of a weird one. So I have a form that is hidden until a button is clicked, once it's clicked the table is visible and has a .blur function on the inputs to check if they're empty. I've tried adding alert()
throughout the pcontroller and it just never get's into the function.
Here's what's in the controller (document ready is done earlier on)
var newQuestionName = $('#questionName');
function basicValidate(object) {
var val1 = object.val();
if (val1 != null && val1 != ' ' && val1 != '') {
// invalid
object.removeClass('error');
return true;
// alert('true');
} else {
// true
object.addClass('error');
return false;
// alert('invalid');
}
}
newQuestionName.blur(function () {
alert('TEST');
if (basicValidate($(this))) {
add_newQuestionName_valid = true;
alert('new question true')
} else {
add_newQuestionName_valid = false;
alert('new question false')
}
});
Here's the HTML
<form action="">
<div class="row">
<label for="questionName">
FAQ Question:
</label>
<div class="input-container">
<input id="questionName" type="text" class="text" value="">
</div>
</div>
<div class="row">
<label for="questionAnswer">
FAQ Answer:
</label>
<div class="input-container">
<textarea id="questionAnswer" cols="30" rows="10"></textarea>
</div>
</div>
<div class="row">
<div class="submit-container submit" >
<div type="submit" ng-click="newFaq()" id="addNew" class="button" value="save">save</div>
</div>
</div>
</form>