Blame view

frontend/web/js/validation/demo/custom-messages-data-demo.html 1.89 KB
18b850c7   Administrator   Importers CRUD
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
  <!DOCTYPE html>
  <html lang="en">
  <head>
  	<meta charset="utf-8">
  	<title>jQuery validation plug-in - comment form example</title>
  	<link rel="stylesheet" media="screen" href="css/screen.css">
  	<script src="../lib/jquery.js"></script>
  	<script src="../dist/jquery.validate.js"></script>
  	<script>
  	$(document).ready(function() {
  		$("#commentForm").validate();
  		$("#commentForm2").validate({
  			messages: {
  				email: {
  					required: 'Enter this!'
  				}
  			}
  		});
  	});
  	</script>
  	<style>
  	form {
  		width: 500px;
  	}
  	form label {
  		width: 250px;
  	}
  	form label.error, form input.submit {
  		margin-left: 253px;
  	}
  	</style>
  </head>
  <body>
  <h1 id="banner"><a href="http://jqueryvalidation.org/">jQuery Validation Plugin</a> Demo</h1>
  <div id="main">
  	<p>Take a look at the source to see how messages can be customized with metadata.</p>
  	<!-- Custom rules and messages via data- attributes -->
  	<form class="cmxform" id="commentForm" method="post" action="">
  		<fieldset>
  			<legend>Please enter your email address</legend>
  			<p>
  				<label for="cemail">E-Mail *</label>
  				<input id="cemail" name="email" data-rule-required="true" data-rule-email="true" data-msg-required="Please enter your email address" data-msg-email="Please enter a valid email address">
  			</p>
  			<p>
  				<input class="submit" type="submit" value="Submit">
  			</p>
  		</fieldset>
  	</form>
  	<!-- Custom message for "required" in metadata is overridden by a validate option -->
  	<form class="cmxform" id="commentForm2" method="post" action="">
  		<fieldset>
  			<legend>Please enter your email address</legend>
  			<p>
  				<label for="cemail">E-Mail *</label>
  				<input id="cemail" name="email" data-rule-required="true" data-rule-email="true" data-msg-email="Please enter a valid email address">
  			</p>
  			<p>
  				<input class="submit" type="submit" value="Submit">
  			</p>
  		</fieldset>
  	</form>
  	<a href="index.html">Back to main page</a>
  </div>
  </body>
  </html>