Browse Source

changes to get PHP contact form working, but call back to js not functional yet

tags/v1.0.0
Frank (inchiostro0 6 years ago
parent
commit
4cd58518f2
3 changed files with 15 additions and 11 deletions
  1. 5
    4
      layouts/partials/contact.html
  2. 3
    2
      layouts/partials/hero-area.html
  3. 7
    5
      static/js/script.js

+ 5
- 4
layouts/partials/contact.html View File

@@ -1,5 +1,5 @@
{{ if .Site.Data.contact.enable }}
{{"<!-- Srart Contact Us -->" | safeHTML}}
{{"<!-- Start Contact Us -->" | safeHTML}}
<section id="contact-us" class="contact-us section-bg">
<div class="container">
<div class="row">
@@ -27,14 +27,15 @@

{{"<!-- Contact Form -->" | safeHTML}}
<div class="contact-form col-md-6 wow fadeInUp" data-wow-duration="500ms" data-wow-delay="300ms">
<form id="contact-form" method="post" action="sendmail.php" role="form">
<form id="contact-form" method="post" action="php/mailer.php" role="form">

<div class="form-group">
<input type="text" placeholder="Your Name" class="form-control" name="name" id="name">
</div>

<div class="form-group">
<input type="email" placeholder="Your Email" class="form-control" name="email" id="email">
<input type="text" name="email" style="display: none;">
<input type="text" placeholder="Your Email" class="form-control" name="email_real" id="email">
</div>

<div class="form-group">
@@ -73,4 +74,4 @@

</section>
{{"<!-- /contact -->" | safeHTML}}
{{ end }}
{{ end }}

+ 3
- 2
layouts/partials/hero-area.html View File

@@ -2,8 +2,9 @@
{{"<!-- Welcome Slider-->" | safeHTML}}
<section class="hero-area" style='background-image: url("{{ .Site.Params.banner.bgImage | absURL }}");'>
<div class="block">
<div class="video-button">
{{with .Site.Params.banner.icon}} <i class="{{ . }}"></i> {{ end }}
<div class="logo">
<p><img class="logo" src="images/logo.png"></p>
{{with .Site.Params.banner.icon}} <i class="{{ . }}"></i> {{ end }} video-button
</div>
{{with .Site.Params.banner.heading}} <h1>{{ . }}</h1>{{ end }}
{{with .Site.Params.banner.content}} <p>{{ . }}</p> {{ end }}

+ 7
- 5
static/js/script.js View File

@@ -95,7 +95,7 @@ jQuery(function ($) {
to determine if there was an error or not */
var error = false;
var name = $('#name').val();
var email = $('#email').val();
var email_real = $('#email_real').val();
var subject = $('#subject').val();
var message = $('#message').val();

@@ -118,9 +118,9 @@ jQuery(function ($) {
}
if (email.length == 0 || email.indexOf('@') == '-1') {
var error = true;
$('#email').css("border-color", "#D8000C");
$('#email_real').css("border-color", "#D8000C");
} else {
$('#email').css("border-color", "#666");
$('#email_real').css("border-color", "#666");
}
if (subject.length == 0) {
var error = true;
@@ -147,7 +147,9 @@ jQuery(function ($) {
/* using the jquery's post(ajax) function and a lifesaver
function serialize() which gets all the data from the form
we submit it to send_email.php */
$.post("sendmail.php", $("#contact-form").serialize(), function (result) {
$.post("php/mailer.php", $("#contact-form").serialize(), function (result) {
//log the result from the script
console.log(result);
//and after the ajax request ends we check the text returned
if (result == 'sent') {
//if the mail is sent remove the submit paragraph
@@ -305,4 +307,4 @@ function initialize() {
map.setMapTypeId('roadatlas');
}

google.maps.event.addDomListener(window, "load", initialize);
google.maps.event.addDomListener(window, "load", initialize);

Loading…
Cancel
Save