[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'} |
---|
| 5 | {if $contact.mandatory_name and !$contact.is_logged} |
---|
| 6 | var author = new LiveValidation('author', {ldelim} onlyOnSubmit: true }); |
---|
[25872] | 7 | author.add(Validate.Presence, {ldelim} failureMessage: "{'Please enter a name'|translate}" }); |
---|
[17483] | 8 | {/if} |
---|
| 9 | |
---|
| 10 | {if $contact.mandatory_mail and (!$contact.is_logged or empty($contact.email))} |
---|
| 11 | var email = new LiveValidation('email', {ldelim} onlyOnSubmit: true }); |
---|
[25872] | 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}" }); |
---|
[17483] | 14 | {/if} |
---|
| 15 | |
---|
[17945] | 16 | {if $GROUPS} |
---|
| 17 | var group = new LiveValidation('group', {ldelim} onlyOnSubmit: true }) |
---|
[25872] | 18 | group.add(Validate.Exclusion, {ldelim} within: ['-1'], failureMessage: "{'Please choose a category'|translate}" }); |
---|
[17945] | 19 | {/if} |
---|
| 20 | |
---|
[17483] | 21 | var subject = new LiveValidation('subject', {ldelim} onlyOnSubmit: true }); |
---|
[25872] | 22 | subject.add(Validate.Presence, {ldelim} failureMessage: "{'Please enter a subject'|translate}" }); |
---|
[18814] | 23 | subject.add(Validate.Length, {ldelim} maximum: 100, |
---|
[25872] | 24 | tooLongMessage: "{'%s must not be more than %d characters long'|translate:'':100}" |
---|
[17483] | 25 | }); |
---|
| 26 | |
---|
| 27 | var content = new LiveValidation('cf_content', {ldelim} onlyOnSubmit: true }); |
---|
[25872] | 28 | content.add(Validate.Presence, {ldelim} failureMessage: "{'Please enter a message'|translate}" }); |
---|
[18814] | 29 | content.add(Validate.Length, {ldelim} maximum: 2000, |
---|
[25872] | 30 | tooLongMessage: "{'%s must not be more than %d characters long'|translate:'':2000}", |
---|
[17483] | 31 | }); |
---|
| 32 | {/footer_script} |
---|
| 33 | |
---|
| 34 | |
---|
| 35 | {if $ContactForm_before} |
---|
| 36 | <div class="contact desc">{$ContactForm_before}</div> |
---|
| 37 | {/if} |
---|
| 38 | |
---|
| 39 | <div class="contact"> |
---|
[19180] | 40 | <form method="post" action="{$F_ACTION}"> |
---|
[17483] | 41 | <table> |
---|
| 42 | <tr> |
---|
[25872] | 43 | <td class="title"><label for="author">{'Your name'|translate}</label></td> |
---|
[17483] | 44 | <td> |
---|
| 45 | {if $contact.is_logged} |
---|
| 46 | {$contact.author} |
---|
| 47 | <input type="hidden" name="author" value="{$contact.author}"> |
---|
| 48 | {else} |
---|
| 49 | <input type="text" name="author" id="author" size="40" value="{$contact.author}"> |
---|
| 50 | {/if} |
---|
| 51 | </td> |
---|
| 52 | </tr> |
---|
| 53 | <tr> |
---|
[25872] | 54 | <td class="title"><label for="email">{'Your e-mail'|translate}</label></td> |
---|
[17483] | 55 | <td> |
---|
| 56 | {if $contact.is_logged and !empty($contact.email)} |
---|
| 57 | {$contact.email} |
---|
| 58 | <input type="hidden" name="email" value="{$contact.email}"> |
---|
| 59 | {else} |
---|
| 60 | <input type="text" name="email" id="email" size="40" value="{$contact.email}"> |
---|
| 61 | {/if} |
---|
| 62 | </td> |
---|
| 63 | </tr> |
---|
[17945] | 64 | {if $GROUPS} |
---|
[17483] | 65 | <tr> |
---|
[25872] | 66 | <td class="title"><label for="group">{'Category'|translate}</label></td> |
---|
[17945] | 67 | <td> |
---|
| 68 | <select name="group" id="group"> |
---|
| 69 | <option value="-1">------------</option> |
---|
| 70 | {html_options options=$GROUPS selected=$contact.group} |
---|
| 71 | </select> |
---|
| 72 | </td> |
---|
| 73 | </tr> |
---|
| 74 | {/if} |
---|
| 75 | <tr> |
---|
[25872] | 76 | <td class="title"><label for="subject">{'Subject'|translate}</label></td> |
---|
[17483] | 77 | <td><input type="text" name="subject" id="subject" style="width:400px;" value="{$contact.subject}"></td> |
---|
| 78 | </tr> |
---|
| 79 | <tr> |
---|
[25872] | 80 | <td class="title"><label for="cf_content">{'Message'|translate}</label></td> |
---|
[17483] | 81 | <td><textarea name="content" id="cf_content" rows="10" style="width:400px;">{$contact.content}</textarea></td> |
---|
| 82 | </tr> |
---|
| 83 | <tr> |
---|
| 84 | <td class="title"> </td> |
---|
[19180] | 85 | <td> |
---|
[25872] | 86 | <input class="submit" type="submit" name="send_mail" value="{'Send'|translate}"> |
---|
| 87 | <label><input type="checkbox" name="send_copy"> {'Send copy to my email'|translate}</label> |
---|
[19180] | 88 | </td> |
---|
[17483] | 89 | </tr> |
---|
| 90 | </table> |
---|
[25872] | 91 | |
---|
[17483] | 92 | <input type="hidden" name="key" value="{$KEY}" /> |
---|
| 93 | </form> |
---|
| 94 | </div> |
---|
| 95 | |
---|
| 96 | {if $ContactForm_after} |
---|
| 97 | <div class="contact desc">{$ContactForm_after}</div> |
---|
[25872] | 98 | {/if} |
---|