Project

Profile

Help

Contact Forms with Planio » History » Sprint/Milestone 31

Jan Schulz-Hofen, 11/19/2016 02:21 PM

1 26 Jan Schulz-Hofen
# Set Up a Contact Form on your own Website with CRM & Helpdesk
2 8 Thomas Carney
3 30 Jan Schulz-Hofen
In this guide, we will look at setting up a contact form on your own website that sends your customer's messages directly to Planio where they'll appear as issues in Planio's CRM & Helpdesk.
4 1 Thomas Carney
5 19 Thomas Carney
{{>toc}}
6 5 Thomas Carney
7 10 Thomas Carney
## Benefits
8 1 Thomas Carney
9 25 Jan Schulz-Hofen
  - Reply to website inquiries directly from Planio using the CRM & Helpdesk App. 
10 1 Thomas Carney
  - Don't let inquiries slip through the cracks in your overloaded email inbox.
11 30 Jan Schulz-Hofen
  - Work as a team on customer support.
12
  - Become more efficient by using auto-replies and CRM templates.
13 14 Thomas Carney
  - No need for server-side scripting to handle the contact form submissions.
14 7 Thomas Carney
15 1 Thomas Carney
## HTML Form
16
17 30 Jan Schulz-Hofen
You can send HTML form requests directly to Planio, as Planio will accept an unauthenticated POST request with `application/x-www-form-urlencoded` form data.
18 1 Thomas Carney
19 30 Jan Schulz-Hofen
Therefore, we’re going to build a simple form with an action attribute that submits the form to Planio via the HTTP POST method.
20 1 Thomas Carney
21
~~~html
22
<form action="https://example.plan.io/track" method="POST">
23 12 Thomas Carney
~~~
24 1 Thomas Carney
25
Then, we’ll add input fields for a name, email, email subject, and the description:
26
27 12 Thomas Carney
~~~html
28 27 Jan Schulz-Hofen
<label for="name">Your name:</label>
29
<input name="name" id="name" type="text" />
30 1 Thomas Carney
31 27 Jan Schulz-Hofen
<label for="mail">Your email address:</label>
32
<input name="mail" id="mail" type="email" />
33 1 Thomas Carney
34 27 Jan Schulz-Hofen
<label for="subject">Subject:</label>
35
<input name="subject" id="subject" type="text" />
36 1 Thomas Carney
37 27 Jan Schulz-Hofen
<label for="description">Your message:</label>
38
<textarea name="description" id="description"></textarea>
39 1 Thomas Carney
~~~
40
41 31 Jan Schulz-Hofen
A Planio account can have multiple projects, so we need a way to assign this message to a particular project in Planio. Therefore, we’ll add a hidden input field with the value set to the identifier of the project you want to forward the issue:
42 1 Thomas Carney
43
~~~html
44 27 Jan Schulz-Hofen
<input name="project" type="hidden" value="example-project" />
45 1 Thomas Carney
~~~
46
47
Then, we add the submit input field:
48
49
~~~html
50 27 Jan Schulz-Hofen
<input type="submit" value="Submit request" />
51 1 Thomas Carney
~~~
52
53 7 Thomas Carney
## Add a Honeypot Field
54 1 Thomas Carney
55 17 Thomas Carney
Forms are frequently the target of spambots that send messages to any form they can find online. One strategy for dealing with spam bots is to add an additional input field to the form called a honeypot field. Then, you hide the form field using CSS. If that input field is filled out, which spambots usually do, then the message is discarded as spam - hence the name honeypot field.
56 5 Thomas Carney
57 1 Thomas Carney
Here’s the honeypot field along with some CSS:
58
59
~~~html
60
<!-- CSS to hide honeypot field -->
61 29 Jan Schulz-Hofen
<style type="text/css">#url { display:none; }</style>
62 28 Jan Schulz-Hofen
<input name="url" id="url" type="text" />
63 1 Thomas Carney
~~~
64
65
So, pulling it all together, our form will look like this:
66
67
~~~html
68
<!-- CSS to hide honeypot field -->
69 29 Jan Schulz-Hofen
<style type="text/css">#url { display:none; }</style>
70 1 Thomas Carney
71
<form action="https://example.plan.io/track" method="POST">
72
73
  <label for="name">Your name:</label>
74
  <input name="name" id="name" type="text" />
75
76
  <label for="mail">Your email address:</label>
77
  <input name="mail" id="mail" type="email" />
78
79
  <label for="subject">Subject:</label>
80
  <input name="subject" id="subject" type="text" />
81
82
  <label for="description">Your message:</label>
83
  <textarea name="description" id="description"></textarea>
84
85
  <input name="project" type="hidden" value="example-project" />
86
  <input name="url" id="url" type="text" />
87
  <input type="submit" value="Submit request" />
88
89
</form>
90
~~~
91 5 Thomas Carney
92 21 Thomas Carney
## A Practical Example
93
94 1 Thomas Carney
When someone fills out this form, the message will show up in Planio as an issue as you can see here:
95
96 24 Jan Schulz-Hofen
![](email-from-contact-form@2x.png)  
97 23 Jan Schulz-Hofen
*A contact form message appears as issue in Planio*
98 1 Thomas Carney
99 11 Thomas Carney
That’s just one of the examples of how you can use the Redmine API at Planio to streamline your processes. You’ll find more examples and documentation in our [Redmine API documentation](https://plan.io/api/).