-
Notifications
You must be signed in to change notification settings - Fork 0
/
form-binding.html
142 lines (129 loc) · 6.85 KB
/
form-binding.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<!-- development version, includes helpful console warnings -->
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>
<body class="container">
<div class="row">
<div class="col-lg-12">
<div id="app">
<br/>
<h2> Contact US </h2>
<form v-on:submit.prevent="formSubmit">
<div class="form-group">
<label for="name">Name </label>
<input type="name" class="form-control" id="name" placeholder="Your Name Here" v-model="form.name"/>
</div>
<div class="form-group">
<label for="email">Email Address</label>
<input type="email" class="form-control" id="email" placeholder="Your email Here" v-model="form.email"/>
</div>
<div class="form-group">
<label for="formControlRange">Gender</label><br/>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="gender" id="gender-male" value="male" v-model="form.gender">
<label class="form-check-label" for="gender">Male</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="gender" id="gender-female" value="female" v-model="form.gender">
<label class="form-check-label" for="gender">Female</label>
</div>
</div>
<div class="form-group">
<label for="refer">From where did you hear about us ?</label>
<select name="refer" class="form-control" id="refer" v-model="form.refer">
<option value="website">Website</option>
<option value="Newspaper">Newspaper</option>
<option value="Friends">Friends</option>
<option value="Add-On">Add-On</option>
<option value="Other">Other</option>
</select>
</div>
<div class="form-group">
<label for="exampleFormCOntrolSelect2">You are a :</label>
<select muptiple class="form-control" id="exampleFormControlSelect2" v-model="form.profession">
<option value="developer">Developer</option>
<option value="designer">Graphic Designer</option>
<option value="manager">Manager</option>
<option value="ceo">CEO</option>
<option value="Other">Other</option>
</select>
</div>
<div class="form-group">
<label for= "formControlRange">Which of the services are you interested in ?</label></br>
<div class="form-check form-check-inline">
<input type="checkbox" id="inlineCheckbox1" value="online" v-model="form.interested" class="form-check-input">
<label for="inlineCheckbox1" class="form-check-label">Online Tests</label>
</div>
<div class="form-check form-check-inline">
<input type="checkbox" id="inlineCheckbox2" value="paper" v-model="form.interested" class="form-check-input">
<label for="inlineCheckbox2" class="form-check-label">Paper Based Tests</label>
</div>
<div class="form-check form-check-inline">
<input type="checkbox" id="inlineCheckbox3" value="customized" v-model="form.interested" class="form-check-input">
<label for="inlineCheckbox3" class="form-check-label">Customized Tests</label>
</div>
</div>
<div class="form-group">
<label for="message">Your Message</label>
<textarea name="message" class="form-control" id="message" rows="3" v-model="form.message"></textarea>
</div>
<div class="form-group">
<label for='satisfaction'>How satisfied are you with your service?</label>
<input type="range" name="satisfaction" class="form-control-range" id="formControlRange" min="0" max="10" v-model="form.satisfaction">
</div>
<div class="form-group">
<div class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" id = "terms" value="yes" v-model="form.terms">
<label for="inlineCheckbox3" class="form-check-label">Agree to terms and COnditions</label>
</div>
</div>
<div class="column">
<section class="section" id="results">
<div class="box alert alert-secondary">
<ul>
<!-- loop through all the `form` properties and show their values -->
<li v-for="(item, k) in form">
<strong>{{ k }}:</strong> {{ item }}
</li>
</ul>
</div>
</section>
</div>
<div class="form-group">
<button class="btn btn-primary">Submit</button>
</div>
</form>
</div>
</div>
</div>
</body>
<script type="text/javascript">
var app= new Vue({
el:'#app',
data:{
form:{
name:"",
email:"",
gender:"",
refer:"",
interested:[],
message:'',
satisfaction:'',
terms:''
}
},
methods:{
formSubmit:function(event){
console.log(this.form);
event.target.reset();
}
}
});
</script>
</html>