I am trying to validate a form using jquery validate with PHP. I have done all this using google......I am new to the web development.The form is working absolutely fine in FF but the script is not wotking in IE 11..HELP ME...THANKS... The code is given below:
<script src="js/jquery-1.9.0.js"></script>
<script src="js/jquery.validate.min.js"></script>
<!-- jQuery Form Validation code -->
<script>
// When the browser is ready...
$function() {
// Setup form validation on the #register-form element
$("#register-form").validate({
// Specify the validation rules
rules: {
topic: "required",
detail: "required",
name: "required",
email: {
required: true,
email: true
},
},
// Specify the validation error messages
messages: {
topic: "Enter the subject for your suggestion",
detial: "Please enter your suggestion",
name: "Please enter your name. It will be kept hidden",
email: "Please enter a valid email address",
/* username: "Please enter a valid username",
password: {
required: "Please provide a password",
minlength: "Your password must be at least 5 characters long"
}*/
},
submitHandler: function(form) {
form.submit();
}
});
});
</script>
<table align="center" width="800px" border="1" class="table_css">
<?php echo $output; ?>
<!-- The form that will be parsed by jQuery before submit -->
<tr><td >Submit Your Suggestion</td></tr>
<tr><td>
<form action="add_topic.php" method="post" id="register-form" name="register-form" novalidate>
<div class="label">Subject</div><input type="text" id="topic" name="topic" value="<?php echo $topic; ?>" size="50"/><br />
<div class="label">Suggestion</div>
<textarea name="detail" cols="60" id="detail" rows="15" value="<?php echo $detail; ?>"></textarea><br />
<div class="label">Name</div><input type="text" id="name" name="name" value="<?php echo $name; ?>" size="30" /><br/>
<div class="label">Email</div><input type="text" id="email" name="email" value="<?php echo $email; ?>" size="30"/><br /><div style="margin-left:200px;"><input type="submit" name="submit" value="Submit" /><input type="reset" name="Submit2" value="Reset" /></div>
</form>
</td>
</tr>
</table>
I am trying to validate a form using jquery validate with PHP. I have done all this using google......I am new to the web development.The form is working absolutely fine in FF but the script is not wotking in IE 11..HELP ME...THANKS... The code is given below:
<script src="js/jquery-1.9.0.js"></script>
<script src="js/jquery.validate.min.js"></script>
<!-- jQuery Form Validation code -->
<script>
// When the browser is ready...
$function() {
// Setup form validation on the #register-form element
$("#register-form").validate({
// Specify the validation rules
rules: {
topic: "required",
detail: "required",
name: "required",
email: {
required: true,
email: true
},
},
// Specify the validation error messages
messages: {
topic: "Enter the subject for your suggestion",
detial: "Please enter your suggestion",
name: "Please enter your name. It will be kept hidden",
email: "Please enter a valid email address",
/* username: "Please enter a valid username",
password: {
required: "Please provide a password",
minlength: "Your password must be at least 5 characters long"
}*/
},
submitHandler: function(form) {
form.submit();
}
});
});
</script>
<table align="center" width="800px" border="1" class="table_css">
<?php echo $output; ?>
<!-- The form that will be parsed by jQuery before submit -->
<tr><td >Submit Your Suggestion</td></tr>
<tr><td>
<form action="add_topic.php" method="post" id="register-form" name="register-form" novalidate>
<div class="label">Subject</div><input type="text" id="topic" name="topic" value="<?php echo $topic; ?>" size="50"/><br />
<div class="label">Suggestion</div>
<textarea name="detail" cols="60" id="detail" rows="15" value="<?php echo $detail; ?>"></textarea><br />
<div class="label">Name</div><input type="text" id="name" name="name" value="<?php echo $name; ?>" size="30" /><br/>
<div class="label">Email</div><input type="text" id="email" name="email" value="<?php echo $email; ?>" size="30"/><br /><div style="margin-left:200px;"><input type="submit" name="submit" value="Submit" /><input type="reset" name="Submit2" value="Reset" /></div>
</form>
</td>
</tr>
</table>
Share
Improve this question
edited May 5, 2014 at 13:07
Getz
4,0636 gold badges37 silver badges52 bronze badges
asked May 5, 2014 at 13:06
user3604281user3604281
111 gold badge1 silver badge2 bronze badges
1
- Why don't you simply use "required" in input ? you don't need jQuery to do it :) – Dev'Hamz Commented May 5, 2014 at 13:09
5 Answers
Reset to default 4I had the similar issue. I added the following code to set browser patibility for Internet Explorer to make it run. Add the following code in <head>
tag.
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
It makes the script to work in IE11.
You can simply use the keyword "required" HTML5.
<input type="text" required>
DEMO HERE
Change the name of the submit button
<input type="submit" name="submit" value="Submit" />
to something other than submit.
<input type="submit" name="btnSubmit" value="Submit" />
From another thread, it looks like IE doesn't handle excessive mas well. Try removing the ma after the email
properties in the messages and rules objects.
https://github./jquery-validation/jquery-validation/issues/2225 problems in version 1.18.0
a safe solution would be to install version 1.17.0 -> npm install [email protected] and check if the plugin really is with version 1.17.0