Greetings all,
I’m writing code that AJAX-ifies the EE comment entry form, similar to this thread:
http://ellislab.com/forums/viewthread/177523/
In order to do this, I need to see all HTML error pages that EE might generate when users fill out the comment form (such as name missing, email missing, comment missing, etc.). Then in my AJAX success: function I can check for each type of error and display an appropriate message in the form.
I tried searching through the EE code to find out where these comment form errors are generated, but I can’t find it. I need to see the exact HTML text generated for each error, so that I can pattern-match against that text to “catch” it.
I would appreciate help in finding where these errors are generated in the EE code (or maybe they’re in the DB?).
Thanks
-Northk
If this isn’t clear, here is an example of what I’m talking about (in this case for the contact form):
$(function() {
$('#contact_form').ajaxForm({
url: 'http://www.mywebsite.com',
success: function(data) {
if (data.match(/<title>Error<\/title>/)) {
//grab the error message
var error = $(data).find('ul li:first').text();
// if they didn't enter any message, this is the error we'll get back from the server
if (error == 'Email Message is Required')
{
$('.contact-message').replaceWith('Please enter a message.');
// else there was some other server message we got
} else {
$('.contact-message').replaceWith('I apologize! For some reason the email could not be sent.');
}
} else {
// else no error, fix up a success message
$('.contact-message').replaceWith('Thanks for contacting me! Your email has been sent.');
}
// display the return message box
$('.contact-message-box').fadeIn(1000);
},
dataType: 'html'
});
});