PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Inserting a form in an Overlay

  1. Leslie
    Member

    Hello,

    I have a 'contact' Gravity form inserted and functioning perfectly, but it was inserted into a page/post. I have a 'tell-a-friend' form created and need to have it pull up when I click on an image (link) that tells you to email a friend. The problem is, this 'email a friend' link opens up an overlay that is coded with a cform II. Cforms (originally coded from the purchased theme) just isn't working for me and I want to remove it and insert the Gravity form.

    So...the issue is that I know nothing about PHP, etc., but I do know what file the cforms is pulling from, I just don't know what code/function to use to make it pull the correct Gravity form. It's nothing that I can insert into a post or page. The code below shows how it's currently pulling the cforms plugin:

    <div id="emailoverlay" class="overlay largeoverlay">
    		<h2><?php echo $OPTION['wps_email_a_friend_title']; ?></h2>
    		<p><?php echo $OPTION['wps_email_a_friend_text']; ?></p>
    		<?php
    		if(function_exists('is_tellafriend')){
    			if(is_tellafriend( $post->ID )) insert_cform(2);
    		} else {
    			echo "
    			<p></p>
    			";

    Any suggestions?

    Thanks -

    Posted 13 years ago on Saturday September 24, 2011 | Permalink
  2. You will want to remove the call to the function that was embedding the cform and replace it with the function call to the Gravity Form.

    The function to embed a form manually is documented here:
    http://www.gravityhelp.com/documentation/page/Embedding_A_Form

    I would start very simply with something like this and see what it looks like:

    [php]
    <div id="emailoverlay" class="overlay largeoverlay">
    <?php gravity_form(ID, true, true, false, false); ?>
    </div>

    You will need to change ID there to the ID of your tell a friend Gravity Form. The form title and description from your Gravity Form settings will be displayed here. You may need to do some CSS work to get it looking the same.

    Also, I'm not sure when the form should show up, or how the form ID is being used in the message that is sent to a friend. But using the function call is a start.

    In addition, since you are embedding the form with the function call, you will need to enqueue the CSS and scripts manually. See here:

    http://www.gravityhelp.com/documentation/page/Gravity_form_enqueue_scripts

    Posted 13 years ago on Sunday September 25, 2011 | Permalink
  3. It's also possible you could just replace this line:

    [php]
    insert_cform(2);

    with this:

    [php]
    gravity_form(ID, true, true, false, false);

    And things might work, depending on what that is_tellafriend function looks like. There are a couple different ways to approach it and you might have to experiment a little bit.

    Posted 13 years ago on Sunday September 25, 2011 | Permalink
  4. Leslie
    Member

    That's what I was looking for...thanks very much.

    Posted 13 years ago on Sunday September 25, 2011 | Permalink
  5. Great. Glad you got it working.

    Posted 13 years ago on Sunday September 25, 2011 | Permalink

This topic has been resolved and has been closed to new replies.