View Single Post
Old 12-24-2011, 11:24 AM   PM User | #2
MarPlo
Regular Coder

 
Join Date: Mar 2011
Posts: 145
Thanks: 0
Thanked 20 Times in 20 Posts
MarPlo is an unknown quantity at this point
The error is that you get the form fields when the image is clicked, so, the fields not completed.
But you must get the fields when the button is clicked.
Try this:
Code:
<script type="text/javascript">
$(document).ready (function () {
$('#form').hide();
$('#imageclick img').click(function () {
$('#form').slideToggle('slow');
$('.fullname').focus();
$('.sendmessage').click(function () {
var fullname = $('.fullname').val();
var emailaddress= $('.emailfield').val();
var comments = $('.messagetext').val();
if ((fullname =='') || (emailaddress =='') || (comments =='')){
alert ("Please, all fields are required, make sure you have not missed any of them, thank you!");
return false;
} else if
((fullname.length < 20) || (comments.length < 20)) {
alert ("A minimum of 20 chracters must be entered in both the name and message fields to send the message!");
return false;
} else {
return true;
}
});
});
});
</script>
__________________
MarPlo is offline   Reply With Quote