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

Last change on this file since 26070 was 26070, checked in by mistic100, 10 years ago

try to simplify integration of captchas

File size: 4.0 KB
RevLine 
[25872]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"}
[17483]3
4{footer_script require='livevalidation'}
[26070]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}
[17483]10
[26070]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}
[17483]16
[26070]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}
[17945]21
[26070]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    });
[17483]27
[26070]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}());
[17483]34{/footer_script}
35
36
37{if $ContactForm_before}
38<div class="contact desc">{$ContactForm_before}</div>
39{/if}
40
41<div class="contact">
[19180]42  <form  method="post" action="{$F_ACTION}">
[17483]43    <table>
44      <tr>
[25872]45        <td class="title"><label for="author">{'Your name'|translate}</label></td>
[17483]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>
[25872]56        <td class="title"><label for="email">{'Your e-mail'|translate}</label></td>
[17483]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>
[26070]66    {if $GROUPS}
[17483]67      <tr>
[25872]68        <td class="title"><label for="group">{'Category'|translate}</label></td>
[17945]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>
[26070]76    {/if}
[17945]77      <tr>
[25872]78        <td class="title"><label for="subject">{'Subject'|translate}</label></td>
[17483]79        <td><input type="text" name="subject" id="subject" style="width:400px;" value="{$contact.subject}"></td>
80      </tr>
81      <tr>
[25872]82        <td class="title"><label for="cf_content">{'Message'|translate}</label></td>
[17483]83        <td><textarea name="content" id="cf_content" rows="10" style="width:400px;">{$contact.content}</textarea></td>
84      </tr>
[26070]85    {if isset($CRYPTO)}
86      {$CRYPTO.parsed_content}
87    {/if}
88    {if isset($EASYCAPTCHA)}
89      {$EASYCAPTCHA.parsed_content}
90    {/if}
[17483]91      <tr>
92        <td class="title">&nbsp;</td>
[19180]93        <td>
[25872]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>
[19180]96        </td>
[17483]97      </tr>
98    </table>
[25872]99
[17483]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>
[25872]106{/if}
Note: See TracBrowser for help on using the repository browser.