Hi, I am having an issue with getting this form to check that a valid email address has been entered and then if it has to post this to a Parse database. I have removed the API key for Parse but apart from that this is what I entered.
Thanks so much in advance.
$(document).ready(function(){
$("#emailform").validate({
rules: {
email: {
required: true,
email: true
}
},
messages: {
email: "Please enter a valid email address"
}
});
$(".cancel").click(function() {
validator.resetForm();
});
var parseAPPID = "";
var parseJSID = "";
Parse.initialize(parseAPPID, parseJSID);
var CommentObject = Parse.Object.extend("CommentObject");
$("#emailform").on("submit", function(e) {
e.preventDefault();
console.log("Handling the submit");
//add error handling here
//gather the form data
var data = {};
data.email = $("#email").val();
var comment = new CommentObject();
comment.save(data, {
success:function() {
console.log("Success");
alert("Thanks for filling the form!");
},
error:function(e) {
console.dir(e);
}
});
});
});