Hi
I’m trying to validate a few forms with jQuery but none works, even if at least one of them was working before. Here is the code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title><?php echo $title['title']; ?></title>
<base href="http://root.com/divdev/">
<meta http-equiv="Content-Type" content="text/html; charset=Western (ISO-8895-1)" />
<link rel="stylesheet" type="text/css" href="css/frontend.css">
<script src="//code.jquery.com/jquery-1.9.1.js"></script>
<script src="//ajax.aspnetcdn.com/ajax/jquery.validate/1.9/jquery.validate.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>
<script src="jquery.validate.pack.js" type="text/javascript"></script>
<script type="text/javascript">
// When the browser is ready...
$(function() {
// Setup form validation on the #contactform element
$("#contactform").validate({
// Specify the validation rules
rules: {
contactname: "required",
email: "required",
subject: "required",
message: "required"
},
// Specify the validation error messages
messages: {
contactname: "É obrigatório o preenchimento do seu nome",
email: "É obrigatório o preenchimento do seu email",
subject: "É obrigatório o preenchimento do assunto da mensagem",
message: "É obrigatório o preenchimento da mensagem"
),
submitHandler: function(form) {
form.submit();
}
});
});
</script>
<script>
$('#msg').ready(function () {
setTimeout(function () {
$('#msg').hide();
window.location.href = goto;
}, 3000);
});
});
</script>
<script>
// When the browser is ready...
$(function() {
// Setup form validation on the #addlinkform element
$("#addlinkform").validate({
// Specify the validation rules
rules: {
category: "required",
company: "required",
description: "required",
address: "required",
county: "required",
city: "required",
state: "required",
country: "required",
phone: "required",
email: "required",
duration: "required"
},
// Specify the validation error messages
messages: {
category: "<?php echo $addlinkinfo['category']; ?>",
company: "<?php echo $addlinkinfo['company']; ?>",
email: "<?php echo $addlinkinfo['email']; ?>",
description: "<?php echo $addlinkinfo['description']; ?>",
address: "<?php echo $addlinkinfo['address']; ?>",
county: "<?php echo $addlinkinfo['county']; ?>",
city: "<?php echo $addlinkinfo['city']; ?>",
state: "<?php echo $addlinkinfo['state']; ?>",
country: "<?php echo $addlinkinfo['country']; ?>",
duration: "<?php echo $addlinkinfo['duration']; ?>"
},
submitHandler: function(form) {
form.submit();
}
});
});
</script>
<script>
// When the browser is ready...
$(function() {
// Setup form validation on the #registerform element
$("#registerform").validate({
// Specify the validation rules
rules: {
fname: "required",
lname: "required",
email: {
required: true,
email: true,
},
user: {
required: true,
},
pass1: {
required: true,
},
pass2: {
required: true,
equalTo: "#pass1",
}
},
// Specify the validation error messages
messages: {
fname: "<?php echo $regerror['fname']; ?>",
lname: "<?php echo $regerror['lname']; ?>",
email: {
required: "<?php echo $regerror['email']; ?>",
email: "<?php echo $regerror['valemail']; ?>",
},
user: {
required: "<?php echo $regerror['user']; ?>",
},
pass1: {
required: "<?php echo $regerror['pass1']; ?>",
},
pass2: {
required: "<?php echo $regerror['pass2']; ?>",
equalTo: "<?php echo $regerror['difpass']; ?>",
},
},
submitHandler: function(form) {
form.submit();
}
});
});
</script>
<script>
// Setup form validation on the #loginform element
$("#loginform").validate({
// Specify the validation rules
rules: {
user: "required",
pass: "required"
},
// Specify the validation error messages
messages: {
user: "<?php echo $logerror['user']; ?>",
pass: "<?php echo $logerror['pass']; ?>"
},
submitHandler: function(form) {
form.submit();
}
});
});
</script>
</head>
<body>
I keep all the validation code in the header seccion.
Can any one help me please with this?