wordpress plugin: gravity forms: modal overlay for confirmation

I've just heard back from gravity forms support and they say there is no solution for a modal overlay for the confirmation message.  I'm looking for someone with gravity forms experience that has successfully created this overlay. Any ideas?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jason C. LevineDon't talk to me.Commented:
I can't find a code sample for confirmation after submission but at least one person figured it out:


But no code :(

So what I THINK is going on in the screencast above is the author is using the gform_after_submission() action hook to fire a function that triggers the modal, perhaps similar to this WPBeginner tutorial:


But I can't find a complete, working code sample either and it appears no one has written an extension to GF for this either.
Using the info that Jason gave you, I tried and tested this:

add_filter( 'gform_after_submission', 'sw_gf_thanks_message', 10, 2 );

function sw_gf_thanks_message( $thx_message ) {
	add_action( 'wp_footer', 'sw_gf_thx_msg' );
function sw_gf_thx_msg() { ?>
	<script type="text/javascript">
		alert( "Thank you for contacting us." );
<?php }

Open in new window

I'm sure you could expand on the alert box section to have it auto close etc. and in the gform settings you could choose to have it reload the page your form is on.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Jason C. LevineDon't talk to me.Commented:
And now you know who is lazier between myself and Dyznit.

(hint: It's not Dyznit)
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

lol, Jason - you did the hard part, finding the right info to make it work. I think they still want it to work a little fancier than that, but that should be a good start. What's crazy is that I set up exactly what is being asked for here earlier this year, but for the life of me - I can't remember what site it was on to find and grab the code ;)
phillystyle123Author Commented:
wow -thanks so much for the input guys. i will test. So, i just put Dzynit's code  in my theme's functions.php code, and that's it?
Yes, then test your form and you can edit the alert part of code from there. That's a javascript alert box, so if you want to fancy it up more, you can check out the additional things you can add and you can see easily how you edit the message shown.
phillystyle123Author Commented:
Just tried it - added the code to my functions.php file. I'm already using another gravity filter, so I know they work. This one isn't generating the overlay though. I'm redirected to the thankyou message I have set in the form confirmation section. There are three confirmation types: Text, Page, Redirect. One has to be selected. I've got Text selected.
When I tested it, that's also what I selected - the text option. Did you notice if when you tested the form if the browser showed any jquery or javascript errors? This function adds the javascript to the footer, but if there's an error in another script before this one loads, it won't be able to run.

When you say you're already using another gravity filter, which filter are you using in case maybe the two can't be used at the same time.

I tested it before posting, so I would have to guess that there's a conflict or error happening somewhere along the way.
phillystyle123Author Commented:
I bet that's correct Dzynit. I've got js in my footer and jquery running already. I'll have to test. thanks for the help.
Sure thing. I run into that a lot when a site uses a lot of jquery and javascripts and it does get frustrating. To help test, you could try change the add_action( 'wp_footer' to add_action( 'wp_head' in this function and see if there's a difference. If there's a conflict, then you might be able to pinpoint which other script is causing it.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.