-
Anonymous
Зачем мне нужно два (2) щелчок, чтобы отправить, используя проверку jQuery?
Сообщение
Anonymous »
Зачем мне нужно два клика, чтобы отправить, используя проверку jQuery? < /p>
Код: Выделить всё
contact_form.validate({ ... });
< /code>
$( document ).ready(function() {
// CONTACT FORM
var contact_form = $('#contact-form');
contact_form.validate(
{
rules: {
name: {
//minlength: 2,
required: true
},
email: {
required: true,
email: true
},
subject: {
// minlength: 2,
required: true
},
message: {
//minlength: 2,
required: true
}
},
onfocusout: false,
onkeyup: false,
focusInvalid: false,
showErrors: function() {
//
},
invalidHandler: function(event, validator) {
$('#contact_form_validate').popup('open');
},
submitHandler: function(form) {
//SUBMIT FORM
$(form).submit(function() {
//event.preventDefault();
var str = $(this).serialize();
//load proccess
$.ajax({
url: 'process.mail.jsp',
type : 'POST',
data: str,
//dataType : 'json',
success: function(result){
//open modal
$('#contact_form_success').popup('open');
//empty form
$('#contact_form_success').on( "popupafterclose", function( event, ui ) {
$('#contact-form textarea, #contact-form input').val('');
} );
}
});
});
}
});
// end CONTACT FORM
}); //jquery< /code>
/*
CONTACT
--------------------------
*/
#contact-form {
margin-left: -20px;
margin-right: -20px;
}
#contact-form .row {
padding-left: 20px;
padding-right: 20px;
margin-bottom: 20px;
min-height: 80px;
border-bottom: #F0F0F0 1px solid;
}
#contact-form .row:last-child {
padding-bottom: 0;
border: 0;
margin-bottom: 0;
min-height: 80px;
}
#contact-form .row .label {
width: 30%;
float: left;
padding-top: 20px;
}
#contact-form .row .field {
width: 70%;
float: left;
}
#contact-form span.red {
color: #812d08;
}
#contact-form textarea {
resize: none !important;
max-height: 50px !important;
}< /code>
Name: *
E-mail: *
Subject: *
Message: *
* Required Fields
Подробнее здесь:
https://stackoverflow.com/questions/202 ... y-validate
1749667567
Anonymous
Зачем мне нужно два клика, чтобы отправить, используя проверку jQuery? < /p>
[code]contact_form.validate({ ... });
< /code>
$( document ).ready(function() {
// CONTACT FORM
var contact_form = $('#contact-form');
contact_form.validate(
{
rules: {
name: {
//minlength: 2,
required: true
},
email: {
required: true,
email: true
},
subject: {
// minlength: 2,
required: true
},
message: {
//minlength: 2,
required: true
}
},
onfocusout: false,
onkeyup: false,
focusInvalid: false,
showErrors: function() {
//
},
invalidHandler: function(event, validator) {
$('#contact_form_validate').popup('open');
},
submitHandler: function(form) {
//SUBMIT FORM
$(form).submit(function() {
//event.preventDefault();
var str = $(this).serialize();
//load proccess
$.ajax({
url: 'process.mail.jsp',
type : 'POST',
data: str,
//dataType : 'json',
success: function(result){
//open modal
$('#contact_form_success').popup('open');
//empty form
$('#contact_form_success').on( "popupafterclose", function( event, ui ) {
$('#contact-form textarea, #contact-form input').val('');
} );
}
});
});
}
});
// end CONTACT FORM
}); //jquery< /code>
/*
CONTACT
--------------------------
*/
#contact-form {
margin-left: -20px;
margin-right: -20px;
}
#contact-form .row {
padding-left: 20px;
padding-right: 20px;
margin-bottom: 20px;
min-height: 80px;
border-bottom: #F0F0F0 1px solid;
}
#contact-form .row:last-child {
padding-bottom: 0;
border: 0;
margin-bottom: 0;
min-height: 80px;
}
#contact-form .row .label {
width: 30%;
float: left;
padding-top: 20px;
}
#contact-form .row .field {
width: 70%;
float: left;
}
#contact-form span.red {
color: #812d08;
}
#contact-form textarea {
resize: none !important;
max-height: 50px !important;
}< /code>
Name: *
E-mail: *
Subject: *
Message: *
* Required Fields
[/code]
Подробнее здесь: [url]https://stackoverflow.com/questions/20287573/why-my-form-need-two-2-clicks-to-submit-using-jquery-validate[/url]