templates/Public/Public/contact.ajax.twig line 1

Open in your IDE?
  1. {%- trans_default_domain 'PublicBundle' -%}
  2. {{ form_start(form) }}
  3. <div class="row">
  4. <div class="col-5">
  5. {{ form_row(form.name, { 'label': false, 'attr': { 'placeholder': ('contact.form.name'|trans) } }) }}
  6. {{ form_row(form.email, { 'label': false, 'attr': { 'placeholder': ('contact.form.email'|trans) } }) }}
  7. {{ form_row(form.title, { 'label': false, 'attr': { 'placeholder': ('contact.form.title'|trans) } }) }}
  8. </div>
  9. <div class="col-7">
  10. {{ form_row(form.message, { 'label': false, 'attr': { 'placeholder': ('contact.form.message'|trans), 'rows': 6 } }) }}
  11. <button class="btn btn-primary btn-sm float-right btn-arrow" type="submit">
  12. {{ 'contact.form.send'|trans }}
  13. <span class="icon fa fa-angle-right"></span>
  14. </button>
  15. </div>
  16. </div>
  17. {{ form_rest(form) }}
  18. <script src="https://www.google.com/recaptcha/api.js?render={{ google.recaptcha.site_key }}"></script>
  19. <script>
  20. grecaptcha.ready(function() {
  21. grecaptcha.execute('{{ google.recaptcha.site_key }}', {action: 'homepage'}).then(function(token) {
  22. // ...
  23. });
  24. });
  25. // $('#comment_form').submit(function() {
  26. // // we stoped it
  27. // event.preventDefault();
  28. // var email = $('#email').val();
  29. // var comment = $("#comment").val();
  30. // // needs for recaptacha ready
  31. // grecaptcha.ready(function() {
  32. // // do request for recaptcha token
  33. // // response is promise with passed token
  34. // grecaptcha.execute('put your site key here', {action: 'create_comment'}).then(function(token) {
  35. // // add token to form
  36. // $('#comment_form').prepend('<input type="hidden" name="g-recaptcha-response" value="' + token + '">');
  37. // $.post("form.php",{email: email, comment: comment, token: token}, function(result) {
  38. // console.log(result);
  39. // if(result.success) {
  40. // alert('Thanks for posting comment.')
  41. // } else {
  42. // alert('You are spammer ! Get the @$%K out.')
  43. // }
  44. // });
  45. // });;
  46. // });
  47. // });
  48. </script>