|
1 |
| -# Email Contact Form |
2 |
| - |
3 |
| - |
4 |
| -## Example |
| 1 | +import Tabs from '@theme/Tabs'; |
| 2 | +import TabItem from '@theme/TabItem'; |
5 | 3 |
|
6 |
| -```php |
7 |
| -exp.email.contact_form |
8 |
| -``` |
| 4 | +# Email Contact Form |
9 | 5 |
|
10 |
| -## Parameters |
| 6 | +The purpose of this tag is to create a contact form on one of your pages that your users can use to send you email. |
11 | 7 |
|
12 |
| -### Return |
| 8 | +For full documentation of available parameters please see the [ExpressionEngine Documentation](https://docs.expressionengine.com/latest/add-ons/email.html#email-contact-form). |
13 | 9 |
|
14 |
| -This parameter lets you specify a path (or full URL) where the user should be directed after the form is submitted. Upon submission, the user is presented with a standard “thank you” message and a link. If this parameter is not used, then the link will point to the page they were on prior to arriving at the email form. |
| 10 | +<Tabs> |
| 11 | +<TabItem value="native" label="Native"> |
15 | 12 |
|
16 | 13 | ```php
|
17 |
| -exp.email.contact_form({return: 'email/thanks'}) |
| 14 | +{exp:email:contact_form user_recipients="no" recipients="admin@example.com" charset="utf-8"} |
| 15 | + <h2>Support Form</h2> |
| 16 | + <p> |
| 17 | + <label for="from">Your Email:</label><br /> |
| 18 | + <input type="text" id="from" name="from" size="40" maxlength="35" value="{member_email}" /> |
| 19 | + </p> |
| 20 | + <p> |
| 21 | + <label for="subject">Subject:</label><br /> |
| 22 | + <input type="text" id="subject" name="subject" size="40" value="Contact Form" /> |
| 23 | + </p> |
| 24 | + <p> |
| 25 | + <label for="message">Message:</label><br /> |
| 26 | + <textarea id="message" name="message" rows="18" cols="40"> |
| 27 | + Support Email from: {member_name} |
| 28 | + Sent at: {current_time format="%Y %m %d"} |
| 29 | + </textarea> |
| 30 | + </p> |
| 31 | + <p> |
| 32 | + <input name="submit" type='submit' value='Submit Form' /> |
| 33 | + </p> |
| 34 | +{/exp:email:contact_form} |
18 | 35 | ```
|
19 | 36 |
|
20 |
| -### Form Class |
| 37 | +</TabItem> |
| 38 | +<TabItem value="twig" label="Twig"> |
21 | 39 |
|
22 |
| -With this parameter, you can specify the css class you want the form to have, enabling fine-grained styling of the form. |
| 40 | +```twig |
| 41 | +{% set form = exp.email.contact_form({ |
| 42 | + user_recipients: 'no', |
| 43 | + recipients: 'admin@example.com', |
| 44 | + charset: 'utf-8' |
| 45 | +}) %} |
23 | 46 |
|
24 |
| -```php |
25 |
| -exp.email.contact_form({form_class: 'contact-form'}) |
| 47 | +{{ form.open() | raw }} |
| 48 | +<h2>Support Form</h2> |
| 49 | +<p> |
| 50 | + <label for="from">Your Email:</label><br/> |
| 51 | + <input type="text" id="from" name="from" size="40" maxlength="35" value="{{ form.member_email }}"/> |
| 52 | +</p> |
| 53 | +<p> |
| 54 | + <label for="subject">Subject:</label><br/> |
| 55 | + <input type="text" id="subject" name="subject" size="40" value="Contact Form"/> |
| 56 | +</p> |
| 57 | +<p> |
| 58 | + <label for="message">Message:</label><br/> |
| 59 | + <textarea id="message" name="message" rows="18" cols="40"> |
| 60 | + Support Email from: {{ form.member_name }} |
| 61 | + Sent at: {{ form.current_time.format("Y-m-d") }} |
| 62 | + </textarea> |
| 63 | +</p> |
| 64 | +<p> |
| 65 | + <input name="submit" type='submit' value='Submit Form'/> |
| 66 | +</p> |
| 67 | +{{ form.close() | raw }} |
26 | 68 | ```
|
27 | 69 |
|
28 |
| -### Form ID |
| 70 | +</TabItem> |
| 71 | +<TabItem value="blade" label="Blade"> |
29 | 72 |
|
30 |
| -With this parameter, you can specify the css id you want the form to have. The default value is ‘contact_form’. |
| 73 | +```php |
| 74 | +@php |
| 75 | +$form = $exp->email->contact_form({ |
| 76 | + user_recipients: 'no', |
| 77 | + recipients: 'admin@example.com', |
| 78 | + charset: 'utf-8' |
| 79 | +}) |
| 80 | +@endphp |
31 | 81 |
|
| 82 | +{!! $form->open() !!} |
| 83 | +<h2>Support Form</h2> |
| 84 | +<p> |
| 85 | + <label for="from">Your Email:</label><br/> |
| 86 | + <input type="text" id="from" name="from" size="40" maxlength="35" value="{{ $form->member_email }}"/> |
| 87 | +</p> |
| 88 | +<p> |
| 89 | + <label for="subject">Subject:</label><br/> |
| 90 | + <input type="text" id="subject" name="subject" size="40" value="Contact Form"/> |
| 91 | +</p> |
| 92 | +<p> |
| 93 | + <label for="message">Message:</label><br/> |
| 94 | + <textarea id="message" name="message" rows="18" cols="40"> |
| 95 | + Support Email from: {{ $form->member_name }} |
| 96 | + Sent at: {{ $form->current_time->format("Y-m-d") }} |
| 97 | + </textarea> |
| 98 | +</p> |
| 99 | +<p> |
| 100 | + <input name="submit" type='submit' value='Submit Form'/> |
| 101 | +</p> |
| 102 | +{!! $form->close() !!} |
| 103 | +``` |
32 | 104 |
|
33 |
| -```php |
34 |
| -exp.email.contact_form({form_id: 'contact_form'}) |
35 |
| -``` |
| 105 | +</TabItem> |
| 106 | +</Tabs> |
0 commit comments