source: extensions/ContactForm/themes/cf_form.tpl @ 8151

Revision 8151, 4.0 KB checked in by Gotcha, 9 years ago (diff)

bug:2065

Line 
1{known_script id="jquery" src=$ROOT_URL|@cat:"themes/default/js/jquery.packed.js"}
2{known_script id="jquery.ui" src=$ROOT_URL|@cat:"themes/default/js/ui/ui.core.packed.js"}
3{known_script id="jquery.ui.resizable" src=$ROOT_URL|@cat:"themes/default/js/ui/ui.resizable.packed.js"}
4{literal}
5<script type="text/javascript">
6jQuery().ready(function(){
7    // Resize possible for textarea
8    jQuery("#cf_message").resizable({
9        handles: "all",
10        animate: true,
11        animateDuration: "slow",
12        animateEasing: "swing",
13        preventDefault: true,
14        preserveCursor: true,
15        autoHide: true,
16        ghost: true
17      });
18  });
19jQuery().ready(function(){
20  // Resize possible for textarea
21  jQuery(".cf-input").resizable({
22        handles: "e",
23        animate: true,
24        animateDuration: "slow",
25        animateEasing: "swing",
26        preventDefault: true,
27        preserveCursor: true,
28        autoHide: true,
29        ghost: true
30      });
31  });
32
33function cf_validate() {
34  var items = new Array('cf_from_name','cf_from_mail','cf_subject','cf_message');
35  var is_mail = new Array(false,true,false,false);
36  var is_needed = new Array(
37    {/literal}{if $CF.NEED_NAME}true{else}false{/if}{literal},
38    {/literal}{if $CF.NEED_MAIL}true{else}false{/if}{literal},
39    true,true);
40  var messages = new Array(
41    '{/literal}{'cf_from_name_error'|@translate|@escape:javascript}{literal}',
42    '{/literal}{'cf_mail_format_error'|@translate|@escape:javascript}{literal}',
43    '{/literal}{'cf_subject_error'|@translate|@escape:javascript}{literal}',
44    '{/literal}{'cf_message_error'|@translate|@escape:javascript}{literal}');
45  var i;
46  for (i=0 ; i<items.length ; i++) {
47    var item = document.getElementById(items[i]);
48    var is_ok = cf_check_content(item, is_mail[i]);
49    if (!is_ok && is_needed[i]) {
50      alert(messages[i]);
51      item.focus();
52      return false;
53    }
54  }
55  return true;
56}
57</script>
58{/literal}
59<div id="autre_content" class="contact-form">
60  <form  method="post" action="{$CF.F_ACTION}" class="filter" id="contactform" onsubmit="return cf_validate();">
61  <div class="contact-form-content">
62    <table>
63      <tr>
64        <td class="contact-form-left">{'cf_from_name'|@translate}</td>
65        <td class="contact-form-right">
66        {if $CF.LOGGED}
67          <input type="text" name="cf_from_name_label" id="cf_from_name" size="40" value="{$CF.NAME}" disabled="disabled" class="cf-input-disabled">
68          <input type="hidden" name="cf_from_name" value="{$CF.NAME}" />
69        {else}
70          <input type="text" name="cf_from_name" id="cf_from_name" size="40" value="{$CF.NAME}" class="cf-input">
71        {/if}
72        </td>
73      </tr>
74      <tr>
75        <td class="contact-form-left">{'cf_from_mail'|@translate}</td>
76        <td class="contact-form-right">
77        {if $CF.LOGGED and ''!=$CF.EMAIL}
78          <input type="text" name="cf_from_mail_label" id="cf_from_mail" size="40" value="{$CF.EMAIL}" disabled="disabled" class="cf-input-disabled">
79          <input type="hidden" name="cf_from_mail" value="{$CF.EMAIL}" />
80        {else}
81          <input type="text" name="cf_from_mail" id="cf_from_mail" size="40" value="{$CF.EMAIL}" class="cf-input"></td>
82        {/if}
83        </td>
84      </tr>
85      <tr>
86        <td class="contact-form-left">{'cf_subject'|@translate}</td>
87        <td class="contact-form-right"><input type="text" name="cf_subject" id="cf_subject" size="40" value="{$CF.SUBJECT}" class="cf-input"></td>
88      </tr>
89      <tr>
90        <td class="contact-form-left" id="cf_message_label">{'cf_message'|@translate}</td>
91        <td class="contact-form-right"><textarea name="cf_message" id="cf_message" rows="10" cols="40">{$CF.MESSAGE}</textarea></td>
92      </tr>
93      <tr>
94        <td class="contact-form-left">&nbsp;</td>
95        <td class="contact-form-right"><input class="submit" type="submit" value="{'cf_submit'|@translate}"></td>
96      </tr>
97    </table>
98    <input type="hidden" name="cf_key" value="{$CF.KEY}" />
99    <input type="hidden" name="cf_id" value="{$CF.ID}" />
100  </div>
101  </form>
102</div>
Note: See TracBrowser for help on using the repository browser.