Browse Source

Enable a return message and show that on success.

tags/0.2.0^2
Bèr Kessels 1 year 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 @@
701 701
           <div class="col-xs-12 col-sm-6">
702 702
             <!-- form -->
703 703
             <form action="https://contact.placebazaar.org/messages" method="post" id="contact-form" class="form form--contacts">
704
+              <div class="alert alert-success hidden" role="alert"></div>
704 705
               <input type="text" class="form__input" name="name" placeholder="Name">
705 706
               <input type="text" class="form__input" name="email" placeholder="Email">
706 707
               <textarea class="form__textarea" name="message" placeholder="Message"></textarea>
@@ -710,6 +711,8 @@
710 711
                 <input type="text" name="contact-captcha" id="contact-captcha" tabindex="-1" value="">
711 712
               </div>
712 713
 
714
+              <input type="hidden" name="return" id="return" value="https://placebazaar.org/?msg=Thank+you+for+contacting+us#contact" />
715
+
713 716
               <button class="form__btn" type="submit">Send</button>
714 717
             </form>
715 718
             <!-- end form -->

+ 3
- 0
index.html.erb View File

@@ -701,6 +701,7 @@
701 701
           <div class="col-xs-12 col-sm-6">
702 702
             <!-- form -->
703 703
             <form action="https://contact.placebazaar.org/messages" method="post" id="contact-form" class="form form--contacts">
704
+              <div class="alert alert-success hidden" role="alert"></div>
704 705
               <input type="text" class="form__input" name="name" placeholder="Name">
705 706
               <input type="text" class="form__input" name="email" placeholder="Email">
706 707
               <textarea class="form__textarea" name="message" placeholder="Message"></textarea>
@@ -710,6 +711,8 @@
710 711
                 <input type="text" name="contact-captcha" id="contact-captcha" tabindex="-1" value="">
711 712
               </div>
712 713
 
714
+              <input type="hidden" name="return" id="return" value="https://placebazaar.org/?msg=Thank+you+for+contacting+us#contact" />
715
+
713 716
               <button class="form__btn" type="submit">Send</button>
714 717
             </form>
715 718
             <!-- end form -->

+ 19
- 0
js/main.js View File

@@ -1,3 +1,13 @@
1
+function getParameterByName(name, url) {
2
+    if (!url) url = window.location.href;
3
+    name = name.replace(/[\[\]]/g, "\\$&");
4
+    var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
5
+        results = regex.exec(url);
6
+    if (!results) return null;
7
+    if (!results[2]) return '';
8
+    return decodeURIComponent(results[2].replace(/\+/g, " "));
9
+}
10
+
1 11
 $(document).ready(function () {
2 12
 	"use strict"; // start of use strict
3 13
 
@@ -198,4 +208,13 @@ $(document).ready(function () {
198 208
 		e.preventDefault();
199 209
 		$.magnificPopup.close();
200 210
 	});
211
+
212
+	/*==============================
213
+	Contact Form
214
+	==============================*/
215
+  /* Success Message */
216
+  if (getParameterByName('msg')) {
217
+    var message = getParameterByName('msg');
218
+    $('#contact-form .alert.alert-success').html(message).removeClass('hidden');
219
+  };
201 220
 });

Loading…
Cancel
Save