source: extensions/ContactForm/themes/simple-black/cf_form.tpl @ 8196

Last change on this file since 8196 was 8196, checked in by Gotcha, 13 years ago

bug:2065 (remove Javascript in head)
Ready for v1.1.6

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