$(function()
{
$("#sky-form").validate(
{
rules:
{
name:
{
required: true
},
email:
{
required: true,
email: true
},
message:
{
required: true,
minlength: 10
},
captcha:
{
required: true,
remote: '/'
}
},
messages:
{
name:
{
required: 'Please enter your name',
},
email:
{
required: 'Please enter your email address',
email: 'Please enter a VALID email address'
},
message:
{
required: 'Please enter your message'
},
captcha:
{
required: 'Please enter characters',
remote: 'Correct captcha is required'
}
},
submitHandler: function(form)
{
$(form).ajaxSubmit(
{
beforeSend: function()
{
$('#sky-form button[type="submit"]').attr('disabled', true);
},
success: function()
{
$("#sky-form").addClass('submited');
}
});
},
errorPlacement: function(error, element)
{
error.insertAfter(element.parent());
}
});
});