I also came here looking for a solution, preferably one that allowed me to be flexible and have it run over many forms. I took the code by Alex and did a bit of hacking on it so that I could "enable" the confirmation in the backend.
jQuery(document).ready(function(){
jQuery("input.button").click(
function(){
if(jQuery(".email input").val() != jQuery(".confirm-email input").val())
{
jQuery(".confirm-email").addClass("gfield_error");
jQuery(".confirm-email .validation_message").remove();
jQuery(".confirm-email .ginput_container").append("<div class='gfield_description validation_message'>Your emails do not match.</div>");
return false;
}
}
);
});
So now all you need to do is create an email field and give it a class name of "email" in the advanced tab and then create a single line text field (people do not need to be told twice that they have not entered a valid email) and give it the class name "confirm-email".
What you guys think?
Only down side is that the validation run before the rest of the form validation but at least it is there.
Posted 14 years ago on Tuesday June 8, 2010 |
Permalink