views:

112

answers:

1

Hello,

I'm using Radiant with the mailer extension to provide a contact form on my website.

I'd like to display a nice "your email has been successfully sent" message after sending the email.
However Radiant seems to only allow redirect in it's configuration. Not to define flash messages.
Would you know of a way to define flash messages via the radiant mailer extension ?

A: 

Okey, I've been digging and resolved my problem with the following :

After sending an email, the redirected page has the anchor #mailer. So with a bit of javascript, I detect the presence of that anchor and I display the "thanks for your email" message".

Here's my code (using JQuery)

<script type="text/javascript">
    $(document).ready(function() {
        $('#flash').hide();
        if (window.location.href.match(/\#mailer/)) {
            $('#flash').html('Enter the message here');
            $('#flash').fadeIn(3000);
        }
    });
</script>

<div class="flash"></div>
Damien MATHIEU