Salve, sto utilizzando uno javascript per un contact form che ha l'effetto dropdown (a discesa) e cioè quando ci si clicca sopra scende giu il form tipico contatti.
Lo script è questo: http://designshack.co.uk/articles/ja...y-contact-form
Il problema è che l'autore non da informazioni per l'implementazione con un semplice sendmail, cioè per far in modo che il form invii realmente le email, una volta compilato il form.
Dunque ho aggiunto una parte di codice per fare il tutto, lo script è questo:
e io ho aggiunto questo (e ovviamente ho creato anche il file process.php):codice:$(document).ready(function(){ $("#contactLink").click(function(){ if ($("#contactForm").is(":hidden")){ $("#contactForm").slideDown("slow"); } else{ $("#contactForm").slideUp("slow"); } }); }); function closeForm(){ $("#messageSent").show("slow"); setTimeout('$("#messageSent").hide();$("#contactForm").slideUp("slow")', 4000); }
Ma aggiungendo questa seconda parte di codice, il form non funziona più, non scende più cliccandoci.codice://if submit button is clicked $('#submit').click(function () { //Get the data from all the fields var name = $('input[name=name]'); var email = $('input[name=email]'); var camera = $('select[name=camera]'); var arrivo = $('textarea[name=arrivo]'); var uscita = $('textarea[name=uscita]'); var message = $('textarea[name=message]'); } //Simple validation to make sure user entered something //If error found, add hightlight class to the text field if (name.val()=='') { name.addClass('hightlight'); return false; } else name.removeClass('hightlight'); if (email.val()=='') { email.addClass('hightlight'); return false; } else email.removeClass('hightlight'); if (camera.val()=='') { camera.addClass('hightlight'); return false; } else camera.removeClass('hightlight'); if (message.val()=='') { message.addClass('hightlight'); return false; } else message.removeClass('hightlight'); //organize the data properly var data = 'name=' + name.val() + '&email=' + email.val() + '&camera=' + website.val() + '&arrivo=' + + '&uscita=' + uscita.val() encodeURIComponent(message.val()); //disabled all the text fields $('.text').attr('disabled','true'); //start the ajax $.ajax({ //this is the php file that processes the data and send mail url: "process.php", //GET method is used type: "GET", //pass the data data: data, //Do not cache the page cache: false, //success success: function (html) { //if process.php returned 1/true (send mail success) if (html==1) { //hide the form $('.form').fadeOut('slow'); //show the success message $('.done').fadeIn('slow'); //if process.php returned 0/false (send mail failed) } else alert('Sorry, unexpected error. Please try again later.'); } }); //cancel the submit button default behaviours return false; }); });
Cosa sbaglio?

Rispondi quotando