bonjour,
j'utilise a script jquerry pour vérifier mon formulaire, l'inscription se pass en trois
étapes mais des la première j'ai un soucis, quand je clique sur le bouton next en pas du formulaire j'ai un message d'alerte
Citation:
|
submit! use link below to go to the other step
|
je veux bien mais a part le bouton next je n'est rien donc je tourne en rond et je ne passe pas a l’étape 2.
le formulaire :
Code :
1 2 3 4 5 6 7 8 9
|
<form id="profileForm" type="actionForm" action="step2.php" method="get" >
blabla
blabla
<div class="buttonSubmit">
<span></span>
<input class="formButton" type="submit" value="Next" style="width: 140px" />
</div> |
le js ;
Code :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124
| $(document).ready(function(){
jQuery.validator.addMethod("password", function( value, element ) {
var result = this.optional(element) || value.length >= 6 && /\d/.test(value) && /[a-z]/i.test(value);
if (!result) {
element.value = "";
var validator = this;
setTimeout(function() {
validator.blockFocusCleanup = true;
element.focus();
validator.blockFocusCleanup = false;
}, 1);
}
return result;
}, "Your password must be at least 6 characters long and contain at least one number and one character.");
// a custom method making the default value for companyurl ("http://") invalid, without displaying the "invalid url" message
jQuery.validator.addMethod("defaultInvalid", function(value, element) {
return value != element.defaultValue;
}, "");
jQuery.validator.addMethod("billingRequired", function(value, element) {
if ($("#bill_to_co").is(":checked"))
return $(element).parents(".subTable").length;
return !this.optional(element);
}, "");
jQuery.validator.messages.required = "";
$("form").validate({
invalidHandler: function(e, validator) {
var errors = validator.numberOfInvalids();
if (errors) {
var message = errors == 1
? 'You missed 1 field. It has been highlighted below'
: 'You missed ' + errors + ' fields. They have been highlighted below';
$("div.error span").html(message);
$("div.error").show();
} else {
$("div.error").hide();
}
},
onkeyup: false,
submitHandler: function() {
$("div.error").hide();
alert("submit! use link below to go to the other step");
},
messages: {
password2: {
required: " ",
equalTo: "Please enter the same password as above"
},
email: {
required: " ",
email: "Merci de rentrer une adresse valide, example: you@yourdomain.com",
remote: jQuery.validator.format("{0} is already taken, please enter a different address.")
}
},
debug:true
});
$(".resize").vjustify();
$("div.buttonSubmit").hoverClass("buttonSubmitHover");
if ($.browser.safari) {
$("body").addClass("safari");
}
$("input.zipcode").mask("99999");
var creditcard = $("#creditcard").mask("9999 9999 9999 9999");
$("#cc_type").change(
function() {
switch ($(this).val()){
case 'amex':
creditcard.unmask().mask("9999 999999 99999");
break;
default:
creditcard.unmask().mask("9999 9999 9999 9999");
break;
}
}
);
// toggle optional billing address
var subTableDiv = $("div.subTableDiv");
var toggleCheck = $("input.toggleCheck");
toggleCheck.is(":checked")
? subTableDiv.hide()
: subTableDiv.show();
$("input.toggleCheck").click(function() {
if (this.checked == true) {
subTableDiv.slideUp("medium");
$("form").valid();
} else {
subTableDiv.slideDown("medium");
}
});
});
$.fn.vjustify = function() {
var maxHeight=0;
$(".resize").css("height","auto");
this.each(function(){
if (this.offsetHeight > maxHeight) {
maxHeight = this.offsetHeight;
}
});
this.each(function(){
$(this).height(maxHeight);
if (this.offsetHeight > maxHeight) {
$(this).height((maxHeight-(this.offsetHeight-maxHeight)));
}
});
};
$.fn.hoverClass = function(classname) {
return this.hover(function() {
$(this).addClass(classname);
}, function() {
$(this).removeClass(classname);
});
}; |
la partie du js concerné (enfin je pense car c'est de la que j'ai le mess)
Code :
1 2 3 4 5
| onkeyup: false,
submitHandler: function() {
$("div.error").hide();
alert("submit! use link below to go to the other step");
}, |
merci
------------------------------
je vient de faire un test car j'ai vu sur un tuto une erreur similaire
Code :
1 2 3 4 5
| onkeyup: false,
submitHandler: function() {
$("div.error").hide();
alert("submit! use link below to go to the other step");
}, |
par
Code :
1 2 3 4 5
| onkeyup: false,
form.submitHandler: function() {
$("div.error").hide();
alert("submit! use link below to go to the other step");
}, |
je passe bien a l'étape 2 mais le css est completement en vrac, donc ca provient bien de cette partie
le tuto :
http://www.vertstudios.com/blog/jque...pment-pattern/
merci
---------------------
alors encore un test, si je rajoute : window.location.href = "step2.php"
je vais bien sur la page une fois validé mais les infos en GET ou POST ne suivent pas ..
merci
--------------
j'ai resolu mon soucis ..
Code :
1 2 3
| submitHandler: function(form) {
$("div.error").hide();
form.submit(); |
merci quand meme