recently i had problem with attaching file into email, i handle that, thanks for you guys btw. Now i have next problem connected with \"fixed\" attching the file. Actually there
Issues 1 & 3 are because you misspelled required
as requred
in the uploaded_file
rule and message.
For issue 2 you need to return false
from submitHandler
to cancel the default form submission
jQuery(function ($) {
$("#formmail").validate({
rules: {
email: {
required: true,
email: true
},
name: {
required: true
},
message: {
required: true
},
uploaded_file: {
required: true
}
}, //koniec literału obiektowego rules
messages: {
email: {
required: "<h3>Podaj adres e-mail.</h3>",
email: "<h3>To nie jest prawidłowy <br>adres e-mail.</h3>"
},
name: {
required: "<h3>Podaj swoje imię i nazwisko.</h3>"
},
message: {
required: "<h3>Wpisz treść listu motywacyjnego.</h3>"
},
uploaded_file: {
required: "<h3>Prześlij plik CV</h3>"
}
},submitHandler: function() {
var thisForm = $('#formmail');
$('#formmail').fadeOut(function(){
//Display the "loading" message
$("#loading-mail").fadeIn(function(){
//Post the form to the send script
$.ajax({
type: 'POST',
url: thisForm.attr("action"),
data: thisForm.serialize(),
//Wait for a successful response
success: function(data){
//Hide the "loading" message
$("#loading-mail").fadeOut(function(){
//Display the "success" message
$("#success").text(data).fadeIn();
});
}
});
});
});
return false
}
});
});
Demo: Fiddle
Note: The ajax submission will not work because of the file input in the form - for some alternates see this answer