× Form Help

Create a Popup Thank You Message

  • Posts: 82
  • Thank you received: 1

geeksscript replied the topic: Create a Popup Thank You Message

Hello,

Yes, I just want to show a pop-up & this has no relation with thank you page.

Please let me know.
#229450
  • Posts: 2154
  • Karma: 67
  • Thank you received: 264

DarkoCujic replied the topic: Create a Popup Thank You Message

Hey,

there are two available options here. One is to display a normal alert window and the other is to display a nicer modal pop-up.

1) Simple alert window:
- in the ActionScript of the select list, click custom, click Change checkbox and click Create code framework.
- between 'case:' and 'break', add the following:
var sel = jQuery('[name="ff_nm_NAME-OF-YOUR-SELECT[]"] option:selected').val();
if (sel == 'option_1') {
  alert('Correct answer');
}

That should be it. It will display a simple alert popup with an OK button and that's it.

2) Modal pop up
- this one is a bit trickier as you have to create the popup on form load and add a style to it
- first go to your Before Form piece (select your form > Advanced tab > More options > Form pieces > Before form > Custom) and copy the style portion:
echo '<style>
/* The Modal (background) */
p {
color:black;
}
.modal {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place */
    z-index: 1000; /* Sit on top */
    padding-top: 100px; /* Location of the box */
    left: 0;
    top: 0;
    width: 100%; /* Full width */
    height: 100%; /* Full height */
    overflow: auto; /* Enable scroll if needed */
    background-color: rgb(0,0,0); /* Fallback color */
    background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
}

/* Modal Content */
.modal-content {
    background-color: #fefefe;
    margin: auto;
    padding: 20px;
    border: 1px solid #888;
    width: 50%;
}

/* The Close Button */
.close {
    color: #aaaaaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
}

.close:hover,
.close:focus {
    color: #000;
    text-decoration: none;
    cursor: pointer;
}
</style>';
- then after that code add the code for the modal window:
echo '<div id="myModal" class="modal">
<div class="modal-content">
  <span class="close">&times;</span>
  <p>Correct answer</p>
</div>
</div>';

- and finally after that add the code to manage opening and closing:
echo '<script>
    jQuery(document).ready(function() {
    var modal = document.getElementById("myModal");
    var btn = document.getElementById("myBtn");
    var span = document.getElementsByClassName("close")[0];

span.onclick = function() {
    modal.style.display = "none";
}
window.onclick = function(event) {
    if (event.target == modal) {
        modal.style.display = "none";
    }
}
});
</script>';

- but we're not done yet as you now need to call the modal with the correct answer. So, do the same as in the first part of code from 1) and instead of that code, use this:
var sel = jQuery('[name="ff_nm_NAME-OF-YOUR-SELECT[]"] option:selected').val();
if (sel == 'value2') {
  jQuery('#myModal').toggle();
}

So to recap once more for this method. All three first codes go to the Before Form and the last code goes to the Action Script of the select list element. Make sure to check if the names of all the elements are the same as in your form and adapt.

Let me know if you have any problems.

Kind regards,
Darko

Satisfied with our support? PayPal tips
===========
Need to renew Pro Support? Buy Here!
===========
Satisfied? Consider a membership!
===========
Like us on Facebook
===========
Support Crosstec and get ALL EXTENSIONS and professional support for just $5. Here!
#229460
The following user(s) said Thank You: geeksscript
  • Posts: 82
  • Thank you received: 1

geeksscript replied the topic: Create a Popup Thank You Message

Hi, clicking on Create code framework shows:
function ff_element1_action(element, action)
{
    switch (action) {
        default:;
    } // switch
} // ff_element1_action

Could you please guide for case / break?
#229467
  • Posts: 2154
  • Karma: 67
  • Thank you received: 264

DarkoCujic replied the topic: Create a Popup Thank You Message

Hey,

delete the generated code, click Change and then generate code framework. I skipped that step in my explanation, sorry.

Kind regards,
Darko

Satisfied with our support? PayPal tips
===========
Need to renew Pro Support? Buy Here!
===========
Satisfied? Consider a membership!
===========
Like us on Facebook
===========
Support Crosstec and get ALL EXTENSIONS and professional support for just $5. Here!
#229468
The following user(s) said Thank You: geeksscript
  • Posts: 82
  • Thank you received: 1

geeksscript replied the topic: Create a Popup Thank You Message

Just Wow! Thank you so much, Darko!

I just sent you a tip over PayPal :)
#229474
  • Posts: 2154
  • Karma: 67
  • Thank you received: 264

DarkoCujic replied the topic: Create a Popup Thank You Message

Hey,

glad we resolved it. I just saw the tip and it was very nice of you. Thank you very much :)

Let us know should you need anything else.

Kind regards,
Darko

Satisfied with our support? PayPal tips
===========
Need to renew Pro Support? Buy Here!
===========
Satisfied? Consider a membership!
===========
Like us on Facebook
===========
Support Crosstec and get ALL EXTENSIONS and professional support for just $5. Here!
#229475
The following user(s) said Thank You: geeksscript
Moderators: ForumSupporttomeperica
Time to create page: 0.077 seconds

New Icon Packs Category!

Crosstec is now offering icon packs.

If you are a paying subscriber, icon packs are automatically added to your account.

Check out our icon packs page!

Live Support Chat Opened!

Join our Discord chat here to receive live support and talk directly to the team!

Summer Sale!

50% discount on all of our extension subscription plans, templates and icon packs!

Get Your Subscription Here

News and Updates

Get informed about new downloads, updates and more in our News and Updates newsletter.

All Extensions Subscription

Get 1 year access to all of our current and future products and 1 year of professional support -- 99 for just 49! (Summer Sale)

No support per domain or website installation limits! Includes all of our current and future Joomla!® extensions, Joomla!® templates for the duration of your membership. This means, by purchasing an All Extensions Subscription you'll have it all covered!

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!

Live Support Chat Opened!

Join our Discord chat here to receive live support and talk directly to the team!

Community Reward

Help us to create new extensions and plugins! With only $5 you help us a lot and get unlimited download access to all of our products, professional support and even more. Get your reward now!

Read More Here