Changeset 26070


Ignore:
Timestamp:
Dec 21, 2013, 6:38:01 PM (7 years ago)
Author:
mistic100
Message:

try to simplify integration of captchas

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/ContactForm/template/contact_form.tpl

    r25872 r26070  
    33
    44{footer_script require='livevalidation'}
    5 {if $contact.mandatory_name and !$contact.is_logged}
    6 var author = new LiveValidation('author', {ldelim} onlyOnSubmit: true });
    7 author.add(Validate.Presence, {ldelim} failureMessage: "{'Please enter a name'|translate}" });
    8 {/if}
     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}
    910
    10 {if $contact.mandatory_mail and (!$contact.is_logged or empty($contact.email))}
    11 var email = new LiveValidation('email', {ldelim} onlyOnSubmit: true });
    12 email.add(Validate.Presence, {ldelim} failureMessage: "{'Please enter an e-mail'|translate}" });
    13 email.add(Validate.Email, {ldelim} failureMessage: "{'mail address must be like xxx@yyy.eee (example : jack@altern.org)'|translate}" });
    14 {/if}
     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}
    1516
    16 {if $GROUPS}
    17 var group = new LiveValidation('group', {ldelim} onlyOnSubmit: true })
    18 group.add(Validate.Exclusion, {ldelim} within: ['-1'], failureMessage: "{'Please choose a category'|translate}" });
    19 {/if}
     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}
    2021
    21 var subject = new LiveValidation('subject', {ldelim} onlyOnSubmit: true });
    22 subject.add(Validate.Presence, {ldelim} failureMessage: "{'Please enter a subject'|translate}" });
    23 subject.add(Validate.Length, {ldelim} maximum: 100,
    24   tooLongMessage: "{'%s must not be more than %d characters long'|translate:'':100}"
    25   });
     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    });
    2627
    27 var content = new LiveValidation('cf_content', {ldelim} onlyOnSubmit: true });
    28 content.add(Validate.Presence, {ldelim} failureMessage: "{'Please enter a message'|translate}" });
    29 content.add(Validate.Length, {ldelim} maximum: 2000,
    30   tooLongMessage: "{'%s must not be more than %d characters long'|translate:'':2000}",
    31   });
     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}());
    3234{/footer_script}
    3335
     
    6264        </td>
    6365      </tr>
    64       {if $GROUPS}
     66    {if $GROUPS}
    6567      <tr>
    6668        <td class="title"><label for="group">{'Category'|translate}</label></td>
     
    7274        </td>
    7375      </tr>
    74       {/if}
     76    {/if}
    7577      <tr>
    7678        <td class="title"><label for="subject">{'Subject'|translate}</label></td>
     
    8183        <td><textarea name="content" id="cf_content" rows="10" style="width:400px;">{$contact.content}</textarea></td>
    8284      </tr>
     85    {if isset($CRYPTO)}
     86      {$CRYPTO.parsed_content}
     87    {/if}
     88    {if isset($EASYCAPTCHA)}
     89      {$EASYCAPTCHA.parsed_content}
     90    {/if}
    8391      <tr>
    8492        <td class="title">&nbsp;</td>
Note: See TracChangeset for help on using the changeset viewer.