Support » Plugin: Popup Maker - Popup Forms, Opt-ins & More » Gravity Forms and dynamic content

  • Resolved mdxclr

    (@mdxclr)


    Hello,
    I want to create popups with a Gravity form inside using this guide:
    http://docs.wppopupmaker.com/article/53-create-read-more-popups-for-posts

    Firstly, I tried to make something like this (call shortcode in shortcode), but that was bad idea (popup was clear).
    echo do_shortcode("[popup id='product-". get_the_ID() ."']". [gravityform id="1" title="false" description="false"] . "[/popup]");

    After that, I found a second way to call a form, but looks like this function use echo too, so my form going out of popup:
    gravity_form(1, false, false, false, '', true);

    So, tried to add it to buffer and replace the form function in popup called with a $output:

    	ob_start();
    	gravity_form(1, false, false, false, '', true);
    	$output = ob_get_contents();
    	ob_end_clean();

    And I got errors in console:

    (index):565 Uncaught SyntaxError: Invalid or unexpected token
    (index):573 Uncaught SyntaxError: Unexpected token <
    (index):679 Uncaught SyntaxError: Invalid or unexpected token
    (index):687 Uncaught SyntaxError: Unexpected token <

    When I looked at this lines – the code (javascript) from the form got tags <p> (something like this):

    			<p>        <script type="text/javascript"></script></p>
    <p>        (function($){</p>
    <p>            window.gwdc = function( options ) {</p>
    <p>                this.options = options;
                    this.startDateInput = $( '#input_' + this.options.formId + '_' + this.options.startFieldId );
                    this.endDateInput = $( '#input_' + this.options.formId + '_' + this.options.endFieldId );
                    this.countInput = $( '#input_' + this.options.formId + '_' + this.options.countFieldId );</p>

    Disabling autop (from content and excerpt doesn’t help, also when I’m echo buffer out of popup – there is no autop)

    After that – I tried to create a function that will return my content (tried with buffer and without it) – all the same like without that function:

    function lol() {
    	ob_start();
    	gravity_form(1, false, false, false, '', true);
    	$output = ob_get_contents();
    	ob_end_clean();
    	return $output;
    }

    So, how can I call the form in popup maker for all posts?

Viewing 9 replies - 1 through 9 (of 9 total)
  • @mdxclr

    Thank you for being patient. I’m going to have our Lead Dev @danieliser take a look as soon as possible.

    We’re currently dealing with a glitch in our Support Portal, so wait times are going to longer than normal.

    Sorry for this inconvenience, but rest assured we will make it here to get this issue resolved.

    Plugin Author danieliser

    (@danieliser)

    @mdxclr – The problem isn’t that your calling a form, its that your calling a form that has already been loaded. Gravity forms can only be inserted on the page once, so you can’t have it in your sidebar and footer for instance, or on the page and in a popup, or in your case in multiple popups.

    Not much we can do about that, and for reference the form simply doesn’t render when this occurs, blank space. You can inspect the source of your popup and you will see a form there but its hidden and never shown via Gravity Forms JS initialization.

    Hope that helps.

    I’m using a Gravity Forms: Multiple Form Instances (with that plugin I can call the same form many times).
    Without popup all my posts have forms normally.
    Also I tried to load form only for one post and still was that problem.

    • This reply was modified 2 years, 12 months ago by  mdxclr.
    • This reply was modified 2 years, 12 months ago by  mdxclr.

    I’ll have @danieliser offer his advice as soon as possible.

    Thank you for being patient.

    Plugin Author danieliser

    (@danieliser)

    @mdxclr – Can you explain exactly what your trying to do? I have a feeling your going about it in the most difficult way. If you want the fields to be dynamically updated, better to use JS and only have one form. IE one popup, with 1 form in it, then when a trigger link is clicked update the hidden fields in your form with the value from the clicked items.

    1 popup / 1 form / millions of links / no extra overhead from all the extra form html.

    My form have dynamic data too which depends from post, like min. order dates, prices per day and have discount or not, based on post_id.
    Displayed in archive in the loop.

    Popup maker preload form, and updating via JS don’t update this data, so the best way to do that without hard codding – call form for each post.

    But this strange autop broke my idea and don’t run scripts.

    Thanks for further details – we’ll have @danieliser take a look as soon as possible.

    I bought Remote Content extension, but it don’t accept post_id where is called..
    Should I create a support ticket in another place then?

    @mdxclr

    Yes, per WP guidelines, if you’re having troubles with a paid product, submit your support request here.

    Thank you for being patient.

    Marking resolved.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Gravity Forms and dynamic content’ is closed to new replies.