Browse Source

Enable a return message and show that on success.

tags/0.2.0^2
Bèr Kessels 2 years ago
parent
commit
24aea39bf3
3 changed files with 25 additions and 0 deletions
  1. 3
    0
      index.html
  2. 3
    0
      index.html.erb
  3. 19
    0
      js/main.js

+ 3
- 0
index.html View File

@@ -701,6 +701,7 @@
<div class="col-xs-12 col-sm-6">
<!-- form -->
<form action="https://contact.placebazaar.org/messages" method="post" id="contact-form" class="form form--contacts">
<div class="alert alert-success hidden" role="alert"></div>
<input type="text" class="form__input" name="name" placeholder="Name">
<input type="text" class="form__input" name="email" placeholder="Email">
<textarea class="form__textarea" name="message" placeholder="Message"></textarea>
@@ -710,6 +711,8 @@
<input type="text" name="contact-captcha" id="contact-captcha" tabindex="-1" value="">
</div>

<input type="hidden" name="return" id="return" value="https://placebazaar.org/?msg=Thank+you+for+contacting+us#contact" />

<button class="form__btn" type="submit">Send</button>
</form>
<!-- end form -->

+ 3
- 0
index.html.erb View File

@@ -701,6 +701,7 @@
<div class="col-xs-12 col-sm-6">
<!-- form -->
<form action="https://contact.placebazaar.org/messages" method="post" id="contact-form" class="form form--contacts">
<div class="alert alert-success hidden" role="alert"></div>
<input type="text" class="form__input" name="name" placeholder="Name">
<input type="text" class="form__input" name="email" placeholder="Email">
<textarea class="form__textarea" name="message" placeholder="Message"></textarea>
@@ -710,6 +711,8 @@
<input type="text" name="contact-captcha" id="contact-captcha" tabindex="-1" value="">
</div>

<input type="hidden" name="return" id="return" value="https://placebazaar.org/?msg=Thank+you+for+contacting+us#contact" />

<button class="form__btn" type="submit">Send</button>
</form>
<!-- end form -->

+ 19
- 0
js/main.js View File

@@ -1,3 +1,13 @@
function getParameterByName(name, url) {
if (!url) url = window.location.href;
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, " "));
}

$(document).ready(function () {
"use strict"; // start of use strict

@@ -198,4 +208,13 @@ $(document).ready(function () {
e.preventDefault();
$.magnificPopup.close();
});

/*==============================
Contact Form
==============================*/
/* Success Message */
if (getParameterByName('msg')) {
var message = getParameterByName('msg');
$('#contact-form .alert.alert-success').html(message).removeClass('hidden');
};
});

Loading…
Cancel
Save