-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcontact.html
77 lines (61 loc) · 2.22 KB
/
contact.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
---
layout: page
title: Contact
description: Let's talk.
permalink: /contact/
---
{% if site.email %}
<style type="text/css" media="screen">
.container {
margin: 0px auto;
max-width: 600px;
}
</style>
<div class="container">
<h2>Talk to Us! ?</h2>
<div id="form" class="contact-form">
<form accept-charset="UTF-8" method="POST" action="https://formspree.io/mbjgbyaa" v-on:submit.prevent="validateBeforeSubmit" ref="contact">
<fieldset>
<input type="hidden" name="_subject" value="New contact!" />
<input type="hidden" name="_next" value="blog.ujwalkr.com/contact/message-sent/" />
<input type="hidden" name="_language" value="English" />
<input type="text" name="name" placeholder="Your name" v-validate="'required'"
:class="{ 'has-error': errors.has('name') }">
<span v-if="errors.has('name')" v-cloak>${ errors.first('name') }</span>
<input type="text" name="email" placeholder="Your e-mail" v-validate="'required|email'"
:class="{ 'has-error': errors.has('email') }">
<span v-if="errors.has('email')" v-cloak>${ errors.first('email') }</span>
<textarea name="message" onkeyup="adjust_textarea(this)" placeholder="Your message" v-validate="'required'"
:class="{ 'has-error': errors.has('message') }"></textarea>
<span v-if="errors.has('message')" v-cloak>${ errors.first('message') }</span>
<button type="submit">Send</button>
</fieldset>
</form>
</div>
</div>
<script type="text/javascript">
function adjust_textarea(h) {
h.style.height = "200px";
h.style.height = (h.scrollHeight)+"px";
}
</script>
<script src="https://unpkg.com/[email protected]"></script>
<script src="https://unpkg.com/[email protected]"></script>
<script type="text/javascript">
Vue.use(VeeValidate);
new Vue({
el: '#form',
delimiters: ['${', '}'],
methods: {
validateBeforeSubmit: function () {
this.$validator.validateAll();
if (!this.errors.any()) {
this.$refs.contact.submit();
}
}
}
});
</script>
{% else %}
<script>window.location = "{% if site.url == '' and site.baseurl == '' %}/{% else %}{{ site.url }}{{ site.baseurl }}{% endif %}";</script>
{% endif %}