-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathanmeldung_jqvalidate.php
143 lines (127 loc) · 5.09 KB
/
anmeldung_jqvalidate.php
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
<!DOCTYPE html>
<?php
session_start();
require_once "class/model.php";
?>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<meta name="description" content="">
<meta name="author" content="sven" >
<link rel="icon" type="image/ico" href="favicon.ico">
<title>Manser Truck AG</title>
<link rel="stylesheet" href="css/bootstrap.css" media="screen">
<link rel="stylesheet" href="css/carousel.css" media="screen">
<link rel="stylesheet" href="scss/style.css" media="screen">
<link rel="stylesheet" href="css/clickdemo.css" media="screen">
<!--link rel="stylesheet" href="css/print.css" media="print"-->
</head>
<body>
<?php include "tmpl_header.html" ?>
<section class="container content">
<h3>JQuery.validate + AJAX-Demo</h3>
<?php if (isset($_GET["inputEmail"])){
echo "<h3>Hallo ".$_GET["inputEmail"]."</h3><p>vielen Dank für Ihre Anmeldung</p>";
}
else { ?>
<form class="bootstrap-iso cmxform col-md-10" id="form_anmeldung" action="#" method="GET">
<div class="form-group col-md-8">
<label for="inputVorname">Vorname</label>
<input type="text" class="form-control" name="inputVorname" id="inputVorname" placeholder="Ihr Vorname">
</div>
<div class="form-group col-md-8">
<label for="inputFamilienname">Familienname</label>
<input type="text" class="form-control" name="inputFamilienname" id="inputFamilienname" placeholder="Familienname">
</div>
<div class="form-group col-md-8">
<label for="inputEmail">Email</label>
<input type="email" class="form-control" name="inputEmail" id="inputEmail" placeholder="Email">
</div>
<div class="form-group col-md-8">
<label for="inputPasswd1">Passwort</label>
<span class="glyphicon glyphicon-eye-open"></span><input type="text" class="form-control" name="inputPasswd1" id="inputPasswd1" minlength="6" placeholder="Passwort eingeben">
</div>
<div class="form-group col-md-8">
<label for="inputPasswd2">Passwort wiederholen</label>
<span class="glyphicon glyphicon-eye-open"></span><input type="text" class="form-control" name="inputPasswd2" id="inputPasswd2" placeholder="Passwort erneut eingeben">
</div>
<span class="clearfix"></span>
<div class="form-group col-md-6">
<button type="submit" class="btn btn-primary">Absenden</button>
</div>
<span class="clearfix"></span>
</form>
<?php } ?>
</section>
<footer class="content">
<a href="http://www.google.com"><span class="topomed-google"></span></a>
<a href="http://www.facebook.com"><span class="topomed-facebook"></span></a>
<a href="http://wwww.twitter.com"><span class="topomed-twitter"></span></a>
<a href="http://behance.com"><span class="topomed-behance"></span></a>
<a href="http://github.io"><span class="topomed-github"></span></a>
<a href="http://vimeo"><span class="topomed-vimeo"></span></a>
</footer>
</div>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/jquery.validate.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
/* toggle visibility of passwords */
$('span.glyphicon').click(function () {
if ($(this).hasClass('glyphicon-eye-open')){
$(this).removeClass('glyphicon-eye-open').addClass('glyphicon-eye-close');
$(this).next().type='password';
}
else {
$(this).addClass('glyphicon-eye-open').removeClass('glyphicon-eye-close');
$(this).next().type='text';
}
})
jQuery.validator.addMethod("checkNames", function (value, element) {
return this.optional(element) || /^([A-Za-z\u00C0-\u017F-]{2,15} ?([A-Za-z\u00C0-\u017F]{2,15})$)/.test(value);
}, "Der Name ist Quatsch!");
$('#form_anmeldung').validate({
rules:{
inputVorname:{
required: true,
minlength: 2,
checkNames : true,
},
inputFamilienname:{
required: true,
minlength: 2,
checkNames : true,
},
inputEmail:{
required: true,
email: true,
remote: {
url: "ajax_handler.php",type: "post",
data: {
user: function(){ return $('#inputEmail').val();}
}
}
},
inputPasswd1:{
required: true,
minlength: 6,
},
inputPasswd2:{
required: true,
equalTo: "#inputPasswd1",
},
},
messages: {
inputEmail: {
remote : "Benutzer existiert bereits",
}
}
});
});
</script>
</body>
</html>