ual_app/app/views/public/contacts/_form.html.haml
Nicolas Bally 57f9e92274 Captcha
2021-06-25 12:06:42 +02:00

28 lines
877 B
Plaintext

- @contact = @contact || Contact.new
=semantic_form_for [:public, @contact], :remote => true do |f|
=f.inputs do
=f.input :name, :label => "Nom :"
=f.input :email, :label => "Email :"
=f.input :tel, :label => "Téléphone :"
=f.input :place, :label => "Lieu de votre projet :"
=f.input :message, :label => "Message :"
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
=raw '<div class="g-recaptcha" data-sitekey="'+RECAPTCHA_SITE_KEY+'"></div>'
=f.submit "Envoyer", :class => "btn"
:javascript
$("form").validationEngine();
$("form").submit(function(event) {
var recaptcha = $("#g-recaptcha-response").val();
if (recaptcha === "") {
event.preventDefault();
alert("Merci de cliquer sur la case 'Je ne suis pas un robot.'");
}
});