|
|
@@ -21,15 +21,22 @@
|
|
|
|
|
|
<form id="defaultForm" method="post" class="form-horizontal" action="target.php">
|
|
|
<div class="form-group">
|
|
|
- <label class="col-sm-3 control-label">Full name</label>
|
|
|
+ <label class="col-sm-3 control-label">First name</label>
|
|
|
<div class="col-sm-4">
|
|
|
<input type="text" class="form-control" name="firstName" placeholder="First name" />
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
<div class="form-group">
|
|
|
+ <label class="col-sm-3 control-label">Last name</label>
|
|
|
+ <div class="col-sm-4">
|
|
|
+ <input type="text" class="form-control" name="lastName" placeholder="Last name" />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="form-group">
|
|
|
<div class="col-sm-9 col-sm-offset-3">
|
|
|
- <button type="submit" class="btn btn-primary">Sign up</button>
|
|
|
+ <button type="submit" class="btn btn-primary">Validate</button>
|
|
|
</div>
|
|
|
</div>
|
|
|
</form>
|
|
|
@@ -42,6 +49,7 @@
|
|
|
$(document).ready(function() {
|
|
|
$('#defaultForm').bootstrapValidator({
|
|
|
container: 'tooltip',
|
|
|
+// trigger: 'blur',
|
|
|
feedbackIcons: {
|
|
|
valid: 'glyphicon glyphicon-ok',
|
|
|
invalid: 'glyphicon glyphicon-remove',
|
|
|
@@ -64,6 +72,21 @@ $(document).ready(function() {
|
|
|
message: 'The first name must consist of a-z, A-Z characters only'
|
|
|
}
|
|
|
}
|
|
|
+ },
|
|
|
+ lastName: {
|
|
|
+ validators: {
|
|
|
+ stringLength: {
|
|
|
+ min: 4,
|
|
|
+ message: 'The last name must be more than 5 characters'
|
|
|
+ },
|
|
|
+ notEmpty: {
|
|
|
+ message: 'The last name is required'
|
|
|
+ },
|
|
|
+ regexp: {
|
|
|
+ regexp: /^[a-z]+$/i,
|
|
|
+ message: 'The last name must consist of a-z, A-Z characters only'
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
});
|