Ver Mensaje Individual
  #1 (permalink)  
Antiguo 17/01/2016, 19:29
sonyw300
 
Fecha de Ingreso: junio-2010
Mensajes: 1
Antigüedad: 13 años, 11 meses
Puntos: 0
hacer funcionar formulario de contacto para web

Buenas soy nuevo en el foro y también en el mundo del diseño web.
Quisiera me den una mano con un formulario de contacto ya que estoy haciendo modificaciones a la web de un amigo .
El problema que tengo es que no he podido hacerlo andar es decir necesito que se envíe el formulario a X correo electronico pero no supe como configurarlo aun.

Espero puedan ayudarme desde ya mil gracias!!.

Este es el formulario en la web: http://www.desbloqueos.com.uy/contact.html

este es el código fuente que me aparece en Dreamweaver:

<div class="standard-form compressed">
<h4 class="semi">Formulario de contacto</h4>
<div class="form-result"></div>
<form action="#" method="post" name="contactus" class="contactForm" id="contactus">
<input type="text" class="input" id="name" name="name" placeholder="Nombre *" />
<input type="text" class="input" id="email" name="email" placeholder="Email *" />
<input type="text" class="input extend" id="subject" name="subject" placeholder="Asunto" />
<textarea name="comment" id="comment" rows="10" cols="65" placeholder="Mensaje *" ></textarea>
<div class="submit">
<a class="button color" href="javascript:contactUsSubmit();"><span>Enviar</span></a>
</div>
<div class="clear"></div>

</form>






y este es el código php del archivo de configuración de los mensajes de errores y demas, que si no estoy mal esta vinculado al codigo fuente con el siguiente nombre (email_conf.js):

// function that submits forms
function submitForm(name) {
document.forms[name].submit();
}
// this function displays/removes the notification boxes
function handleError(element, remove, classEle) {
// the defualt value for the class will be .error-wrapper
classEle = (typeof classEle == "undefined")?'error-wrapper':classEle;

if(element.length == 0) {
return;
}
// if the program wants us to remove the element
if( remove == false ) {
$('.form-result').fadeOut('fast');
}

}
// This funciton submits the form and makes sure there are no mistakes
function contactUsSubmit() {
// this is the name of the "name" feild
var name = document.forms['contactus']['name'].value;
// check if the name is entered
if( name.length == 0 || name == '' || name == null || $.trim(name).length == 0 || name == 'Name *') {
$(".form-result").css("display", "none").html("<p class='note error'>Por favor escriba su nombre.</p><br />").fadeIn(400);
$(".contactForm #name").animate({borderColor: '#ffacac'})
$("#contactus #name").focus();
return;
} else {
// remvoe the error element
$(".contactForm #name").css({borderColor: '#d8d7d7'})
$(".form-result").html("");
}

// store the email in a variable for later use
// this is the comment field
var email = document.forms['contactus']['email'].value;

// validate the email address
var eIsValid = validateEmail( 'contactus', 'email' );
if( !eIsValid ) {
// create the error element
$(".form-result").css("display", "none").html("<p class='note error'>Por favor escriba un email correcto.</p><br />").fadeIn(400);
// put the cursor in the field
$(".contactForm #email").animate({borderColor: '#ffacac'})
$(".contactForm #email").focus();
return;
} else {
$(".form-result").fadeOut('fast').html("");
}

// this is the comment field
var comment = document.forms['contactus']['comment'].value;
// check if the comment
if( comment.length == 0 || comment == '' || comment == null ) {
$(".form-result").css("display", "none").html("<p class='note error'>Por favor escriba un mensaje.</p><br />").fadeIn(400);
$(".contactForm #comment").animate({borderColor: '#ffacac'})
$("#comment").focus();
return;
} else {
// in case there is something that is later wrong with the form
// we need to make sure we clear the error
$(".form-result").fadeOut('fast').html("");
}
var subject = document.forms['contactus']['subject'].value;
// if there is a subject
if( subject.length <= 0 ) {
// No subject is filled in
subject = "No Subject";
}
$(".contactForm > .button").hide(500);
// acquire the correct AJAX object
var xmlhttp = Getxmlhttp();
// Open the server page
xmlhttp.open("GET", 'ajax/email_conf.php?name='+name+'&email='+email+'&comme nt='+comment+'&subject='+subject, true);
xmlhttp.onreadystatechange = function() {
if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
// hide the form
$(".contactForm").slideUp(1000, function() {
// once the form has been hidden
$(".form-result").css("display", "none");
if( parseInt(xmlhttp.responseText) == 1 ) {
// message sent
$(".form-result").css("display", "none").html("<p class='note success'>El mensaje ha sido enviado con exito. Gracias por contactarse con desbloqueos.com.uy!</p><br />").fadeIn('fast');
} else {
// message failed to send
$(".form-result").css("display", "none").html("<p class='note error'>Lo sentimos mucho, su mensaje no ha podido ser enviado.Por favor intentelo de nuevo más tarde! Error Message: "+xmlhttp.responseText+"</p>").fadeIn('fast');
}
$(".form-result").show(1000);
});

}
}
// Send the request
xmlhttp.send(null);
}

// This function validates email addresses without the need to
// use regular expressions
function validateEmail(formname, fieldname) {
var x = document.forms[formname][fieldname].value;
var atpos = x.indexOf("@");
var dotpos = x.lastIndexOf(".");
if (atpos < 1 || dotpos < atpos+2 || dotpos+2 >= x.length) {
return false;
} else {
return true;
}
}

Última edición por sonyw300; 17/01/2016 a las 19:37