"Sign up form [Validations NOT ACHIEVED]"
Bootstrap 4.1.1 Snippet by tieusuquay79

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
<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<!------ Include the above in your HEAD tag ---------->
<!--
Realised by Thibault Leveau
https://www.linkedin.com/in/thibault-leveau-a76923ba/
-->
<div class="container" style="margin-top: 1em;">
<!-- Sign up form -->
<form>
<!-- Sign up card -->
<div class="card person-card">
<div class="card-body">
<!-- Sex image -->
<img id="img_sex" class="person-img"
src="https://visualpharm.com/assets/217/Life%20Cycle-595b40b75ba036ed117d9ef0.svg">
<h2 id="who_message" class="card-title">Who are you ?</h2>
<!-- First row (on medium screen) -->
<div class="row">
<div class="form-group col-md-2">
<select id="input_sex" class="form-control">
<option value="Mr.">Mr.</option>
<option value="Ms.">Ms.</option>
</select>
</div>
<div class="form-group col-md-5">
<input id="first_name" type="text" class="form-control" placeholder="First name">
<div id="first_name_feedback" class="invalid-feedback">
</div>
</div>
<div class="form-group col-md-5">
<input id="last_name" type="text" class="form-control" placeholder="Last name">
<div id="last_name_feedback" class="invalid-feedback">
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
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
body {
background-color: #e9ebee;
}
.card {
margin-top: 1em;
}
/* IMG displaying */
.person-card {
margin-top: 5em;
padding-top: 5em;
}
.person-card .card-title{
text-align: center;
}
.person-card .person-img{
width: 10em;
position: absolute;
top: -5em;
left: 50%;
margin-left: -5em;
border-radius: 100%;
overflow: hidden;
background-color: white;
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
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
// URLs images
var female_img = "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSo8PcCxh7tT6MDFhJi2UaAT9SeciHqvZuaWtGg0y0-yyP8rMDz";
var male_img = "https://visualpharm.com/assets/217/Life%20Cycle-595b40b75ba036ed117d9ef0.svg";
// On page loaded
$( document ).ready(function() {
// Set the sex image
set_sex_img();
// Set the "who" message
set_who_message();
// On change sex input
$("#input_sex").change(function() {
// Set the sex image
set_sex_img();
set_who_message();
});
// On change fist name input
$("#first_name").keyup(function() {
// Set the "who" message
set_who_message();
if(validation_name($("#first_name").val()).code == 0) {
$("#first_name").attr("class", "form-control is-invalid");
$("#first_name_feedback").html(validation_name($("#first_name").val()).message);
} else {
$("#first_name").attr("class", "form-control");
}
});
// On change last name input
$("#last_name").keyup(function() {
// Set the "who" message
set_who_message();
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Related: See More


Questions / Comments: