WebsiteBaker Logo
  • *
  • Templates
  • Help
  • Add-ons
  • Download
  • Home
*
Welcome, Guest. Please login or register.

Login with username, password and session length
 

News


WebsiteBaker 2.13.8 is now available!


R.I.P Dietmar (luisehahne) and thank you for all your valuable work for WB
https://forum.websitebaker.org/index.php/topic,32355.0.html


* Support WebsiteBaker

Your donations will help to:

  • Pay for our dedicated server
  • Pay for domain registration
  • and much more!

You can donate by clicking on the button below.


  • Home
  • Help
  • Search
  • Login
  • Register

  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.12.x) »
  • General Help & Support »
  • ask for e-mail before download
  • Print
Pages: [1]   Go Down

Author Topic: ask for e-mail before download  (Read 10748 times)

johnbroeckaert

  • Guest
ask for e-mail before download
« on: August 25, 2020, 04:25:39 PM »
Hi all,

Is there a simple way to ask for an e-mail address before letting a visitor dowbload an item?

For instance:

Download button -> popup with asking the e-mail address -> download starts

Thanks
Logged

Offline dbs

  • Betatester
  • **
  • Posts: 8920
  • Gender: Male
  • tioz4ever
    • WebsiteBaker - jQuery-Plugins - Module - Droplets - Tests
Re: ask for e-mail before download
« Reply #1 on: August 26, 2020, 10:11:23 AM »
Hi John, maybe this way:
- push button opens a colorbox (.inline) which loads a hidden div.
- in the hidden div is the email field
- after filling the field, the dl button will displayed

Could you also do without colorbox.
- click on dl button shows the email field
- after filling the field, the dl button will displayed

dl button should first save the emailaddress and then call the download.
I think mpform can handle conditional fields.
With miniform it is also possible with your own code.

I don't know a ready solution.
Logged
https://onkel-franky.de

johnbroeckaert

  • Guest
Re: ask for e-mail before download
« Reply #2 on: August 26, 2020, 11:29:37 AM »
I will try the colorbox solution.

in the meantime I have found a solution that could be done if the edior could accommodate a script. That is not for security reasons. Could I put this code and script in a droplet? I have never actually tried that. (template is bootstrap)

Code: [Select]
<script>
function send(){
var  name = $("input#name").val();
var  email = $("input#email").val();
$.ajax({
        type: "POST",
        url: "send.php", //your mailing code is place on send.php
        data:'name='+ name'&email='+email,
        success: function(data){
        $('#download').modal('hide');
        window.location.href='uploads/yourpdf.pdf'; //your file location       
            });
        }
}
</script>

and the HTML

Code: [Select]
<a href="#" class="btn btn-primary" data-toggle="modal" data-target="#download">Download</a>

<!-- modal for download and contact -->
<div class="modal fade" id="download" role="dialog" >
<div class="modal-dialog" >
<div class="modal-content">
<!-- Your contact form goes here --->
<form method="post">
<input type="text" id="name" placeholder="name">
<input type="text" id="email" placeholder="email">
<button onclick="send();">send</button>
</form>
</div></div></div>

Logged

Offline dbs

  • Betatester
  • **
  • Posts: 8920
  • Gender: Male
  • tioz4ever
    • WebsiteBaker - jQuery-Plugins - Module - Droplets - Tests
Re: ask for e-mail before download
« Reply #3 on: August 26, 2020, 01:02:23 PM »
for tests i use code2(html) for something like this.
your both parts can you put in this code2.
Logged
https://onkel-franky.de

johnbroeckaert

  • Guest
Re: ask for e-mail before download
« Reply #4 on: September 02, 2020, 08:36:36 PM »
sorry for the late reaction!
Code 2 solution is Working great (Y)
Logged

  • Print
Pages: [1]   Go Up
  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.12.x) »
  • General Help & Support »
  • ask for e-mail before download
 

  • SMF 2.0.19 | SMF © 2017, Simple Machines
  • XHTML
  • RSS
  • WAP2