I am using jquery-steps for a long form with manu required field. My concern is that each time a condition fails, the page scrolls to the top.
It is particularly annoying on the "terms & conditions" pages which is very long, if the user doesn't check the "I agree" checkbox, it has to go to the bottom to retry.
Here is my simple code:
var form = $("#myform");
form.validate({
errorPlacement: function errorPlacement(error, element) {
if (element.attr("name") == "type") {
error.appendTo($('#errorbox'));
}
else {
element.before(error);
}
},
rules: {
cgu: {
required: true
}
},
messages: {
cgu: {
required: 'Vous devez accepter les C.G.U pour poursuivre'
}
},
focusInvalid: true,
onfocusout: function (element) {
$(element).valid();
},
});
Even with "focusInvalid: true", the page still scrolls top.