source: extensions/ContactForm/template/contact_form.tpl @ 26070

Revision 26070, 4.0 KB checked in by mistic100, 6 years ago (diff)

try to simplify integration of captchas

Line 
1{combine_css path=$CONTACT_FORM_PATH|cat:"template/style.css"}
2{combine_script id="livevalidation" load="footer" path=$CONTACT_FORM_PATH|cat:"template/livevalidation.min.js"}
3
4{footer_script require='livevalidation'}
5(function(){
6  {if $contact.mandatory_name and !$contact.is_logged}
7  var author = new LiveValidation('author', {ldelim} onlyOnSubmit: true });
8  author.add(Validate.Presence, {ldelim} failureMessage: "{'Please enter a name'|translate}" });
9  {/if}
10
11  {if $contact.mandatory_mail and (!$contact.is_logged or empty($contact.email))}
12  var email = new LiveValidation('email', {ldelim} onlyOnSubmit: true });
13  email.add(Validate.Presence, {ldelim} failureMessage: "{'Please enter an e-mail'|translate}" });
14  email.add(Validate.Email, {ldelim} failureMessage: "{'mail address must be like xxx@yyy.eee (example : jack@altern.org)'|translate}" });
15  {/if}
16
17  {if $GROUPS}
18  var group = new LiveValidation('group', {ldelim} onlyOnSubmit: true })
19  group.add(Validate.Exclusion, {ldelim} within: ['-1'], failureMessage: "{'Please choose a category'|translate}" });
20  {/if}
21
22  var subject = new LiveValidation('subject', {ldelim} onlyOnSubmit: true });
23  subject.add(Validate.Presence, {ldelim} failureMessage: "{'Please enter a subject'|translate}" });
24  subject.add(Validate.Length, {ldelim} maximum: 100,
25    tooLongMessage: "{'%s must not be more than %d characters long'|translate:'':100}"
26    });
27
28  var content = new LiveValidation('cf_content', {ldelim} onlyOnSubmit: true });
29  content.add(Validate.Presence, {ldelim} failureMessage: "{'Please enter a message'|translate}" });
30  content.add(Validate.Length, {ldelim} maximum: 2000,
31    tooLongMessage: "{'%s must not be more than %d characters long'|translate:'':2000}",
32    });
33}());
34{/footer_script}
35
36
37{if $ContactForm_before}
38<div class="contact desc">{$ContactForm_before}</div>
39{/if}
40
41<div class="contact">
42  <form  method="post" action="{$F_ACTION}">
43    <table>
44      <tr>
45        <td class="title"><label for="author">{'Your name'|translate}</label></td>
46        <td>
47        {if $contact.is_logged}
48          {$contact.author}
49          <input type="hidden" name="author" value="{$contact.author}">
50        {else}
51          <input type="text" name="author" id="author" size="40" value="{$contact.author}">
52        {/if}
53        </td>
54      </tr>
55      <tr>
56        <td class="title"><label for="email">{'Your e-mail'|translate}</label></td>
57        <td>
58        {if $contact.is_logged and !empty($contact.email)}
59          {$contact.email}
60          <input type="hidden" name="email" value="{$contact.email}">
61        {else}
62          <input type="text" name="email" id="email" size="40" value="{$contact.email}">
63        {/if}
64        </td>
65      </tr>
66    {if $GROUPS}
67      <tr>
68        <td class="title"><label for="group">{'Category'|translate}</label></td>
69        <td>
70          <select name="group" id="group">
71            <option value="-1">------------</option>
72            {html_options options=$GROUPS selected=$contact.group}
73          </select>
74        </td>
75      </tr>
76    {/if}
77      <tr>
78        <td class="title"><label for="subject">{'Subject'|translate}</label></td>
79        <td><input type="text" name="subject" id="subject" style="width:400px;" value="{$contact.subject}"></td>
80      </tr>
81      <tr>
82        <td class="title"><label for="cf_content">{'Message'|translate}</label></td>
83        <td><textarea name="content" id="cf_content" rows="10" style="width:400px;">{$contact.content}</textarea></td>
84      </tr>
85    {if isset($CRYPTO)}
86      {$CRYPTO.parsed_content}
87    {/if}
88    {if isset($EASYCAPTCHA)}
89      {$EASYCAPTCHA.parsed_content}
90    {/if}
91      <tr>
92        <td class="title">&nbsp;</td>
93        <td>
94          <input class="submit" type="submit" name="send_mail" value="{'Send'|translate}">
95          <label><input type="checkbox" name="send_copy"> {'Send copy to my email'|translate}</label>
96        </td>
97      </tr>
98    </table>
99
100    <input type="hidden" name="key" value="{$KEY}" />
101  </form>
102</div>
103
104{if $ContactForm_after}
105<div class="contact desc">{$ContactForm_after}</div>
106{/if}
Note: See TracBrowser for help on using the repository browser.