Last active
April 8, 2016 12:47
-
-
Save mikhaildegtuarev/ac8942e92e8d878b53c57ff85344154d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
$(document).on('af_complete', function(event, response) { | |
var form = response.form; | |
// Если у формы определённый id | |
if (response.success == true) { | |
// Скрываем её! | |
form.hide(); | |
jQuery(".ok-mes").fadeIn(1000); | |
} | |
// Иначе печатаем в консоль весь ответ | |
else { | |
console.log(response) | |
} | |
}); | |
</script> | |
[[!AjaxForm? | |
&snippet=`FormIt` | |
&hooks=`email` | |
&emailTpl=`formTpl` | |
&form=`formHtml` | |
&emailSubject=`Задать вопрос` | |
&emailFrom=`[[++mail_smtp_user]]` | |
&emailTo=`[email protected]` | |
&validate=`name:required,phone:required,message:required` | |
&validationErrorMessage=`Пожалуйста, заполните поля корректно` | |
&successMessage=`Ваша заявка принята, в ближайшее время мы свяжемся с Вами` | |
&status=`1` | |
]] | |
<div class="ok-mes" style="display:none;">Ваша заявка получена, мы Вам скоро перезвоним.</div> | |
<!--AjaxForm задать вопрос--> | |
<form id="my_form_4" action="[[~[[*id]]]]" method="post" class="ajax_form af_example form-horizontal form-blok"> | |
<div class="control-group"> | |
<div class="controls"> | |
<label>Представтесь, пожалуйста</label> | |
<input type="text" id="af_name" name="name" value="[[+fi.name]]" class="span4 forma-input" /> | |
<span class="error_name error-style">[[+fi.error.name]]</span> | |
</div> | |
</div> | |
<div class="control-group"> | |
<div class="controls"> | |
<label>Ваш e-mail</label> | |
<input type="phone" id="af_phone" name="phone" value="[[+fi.e-mail]]" class="span4 forma-input" /> | |
<span class="error_message error-style">[[+fi.error.phone]]</span> | |
</div> | |
</div> | |
<div class="control-group"> | |
<div class="controls"> | |
<label>Ваш вопрос</label> | |
<input type="message" id="af_message" name="message" class="span4 forma-input" style="height: 106px; padding-bottom: 85px;"> | |
<span class="error_message error-style">[[+fi.error.message]]</span> | |
</div> | |
</div> | |
<div class="control-group"> | |
<div class="controls"> | |
<button type="submit" class="button_zvonok">[[%af_submit]]</button> | |
</div> | |
</div> | |
[[+fi.success:is=`1`:then=` | |
<div class="alert alert-success">[[+fi.successMessage]]</div> | |
`]] | |
[[+fi.validation_error:is=`1`:then=` | |
<div class="alert alert-danger">[[+fi.validation_error_message]]</div> | |
`]] | |
</form> | |
<!-- AjaxForm --> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment