Jluis Posted March 7, 2018 Share Posted March 7, 2018 Hello , i have installed a recaptcha module , it works fine withe default contact-form.tpl .When i'm building a specific tpl contact form containing a captcha validation , when submitting the button , it doesn't make the validation either the captcha is verified or not .Below is my contact.tpl file ; what was missing please? is it a ajax issue ? <div class="raw contactez-nous-index parallax-container" data-parallax="scroll" data-bleed="10" data-speed="0.2" data-image-src="img/bg-contact.jpg" data-natural-width="1400" data-natural-height="1400"> <div class="container contact-index"> <img src="img/envolope-contact.png" alt="CONTACT-US"> <p class="titre-equip">CONTACT-US</p> <div class="formulaire-contact-index"> <form class="f-index contact-form-box" name="f-index" id="f-index" method="POST" accept-charset="utf-8"> <div class="alert alert-danger " style="width:50%;margin:10px auto;"></div> <div class="alert alert-success" style="width:50%;margin:10px auto;"></div> <input class="form-index-champs champs-1" type="text" id="first_last_name" name="first_last_name" value="" placeholder="Nom - Prénom"> <input class="form-index-champs champs-2" type="text" id="campany" name="campany" value="" placeholder="Sociéte"> <input class="form-index-champs champs-2" type="email" id="email"name="email" value="" placeholder="E-mail"> <input class="form-index-champs champs-3" type="phone" id="phone" name="phone" value="" placeholder="Téléphone"> <textarea class="text-area-msg" id="message" name="message" placeholder="Message"></textarea> <div id="captcha-box" style="margin: 22px auto;float: none;width: 304px;"></div> </form> <button class="env-btn" type=""><p class="envy">SEND</p></button> </div> </div> </div> <script> $(document).ready(function() { $('.alert-danger').hide(); $('.alert-success').hide(); $('.env-btn').on('click',function(){ var name=$('#first_last_name').val(); var email=$('#email').val(); var phone=$('#phone').val(); var campany=$('#campany').val(); var message=$('#message').val(); $.ajax({ type: 'POST', headers: { "cache-control": "no-cache" }, url: baseUri + '?rand=' + new Date().getTime(), async: true, cache: false, dataType: 'json', data: 'controller=contact&ajax=true&small_contact=true' + '&first_last_name='+name + '&email='+email + '&campany='+campany + '&phone='+phone + '&message='+message + '&token='+static_token, success: function(jsonData) { if(jsonData.result){ $('.alert-success').show(); $('.alert-success').html(''); $('.alert-danger').hide(); $('.alert-danger').html(''); $('.alert-success').prepend('<p>'+jsonData.result+'</p>'); } if(jsonData.error){ $('.alert-danger').show(); $('.alert-success').html(''); $('.alert-success').hide(); $('.alert-danger').html(''); $('.alert-danger').prepend('<p>'+jsonData.error+'</p>'); } } }); }); }); </script> Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now