• Resolved atomicadam

    (@atomicadam)


    Hi – So when I use the do_shortcode to generate the form and post id dynamically, the submit button for the form doesn’t work. As in, click it, nothing happens.

    If i just put the shortcode in the editor field of a post and put in the form ID and post ID, it works as should.

    Code in template looks like this:

    add_action('genesis_loop','edit_form');
    function edit_form() {
    echo do_shortcode( '[gravityform id="7" update="264"]' );
    }

    Suggestions?

    https://wordpress.org/plugins/gravity-forms-post-updates/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter atomicadam

    (@atomicadam)

    I was able to work around this by using the add_filter(‘the_content’).

    Full code looks like this, and it works. But not sure why echo do_shortcode() isn’t allowing submit button to function.

    add_filter('the_content','edit_form');
    function edit_form( $content )
    {
    	$value = true;
    	if( isset( $_SESSION['project_id'] ) ) :
        	$project_id = sanitize_title( $_SESSION['project_id'] );
        	$form_id = sanitize_title( $_SESSION['form_id'] );
    	else:
        	$value = null;
    	endif;
    
    	if( $value == null) :
    		echo '<h4>Something has gone wrong, please go back to dashboard and try again</h4>';
    	else :
    		$content = '[gravityform id="'.$form_id.'" update="'.$project_id.'"]';
    		return $content;
    	endif;
    }
    Plugin Author Jupitercow

    (@jcow)

    I think this question is an issue to raise with the Gravity Forms core team at Rocket Genius. Unless, when you remove the update attribute, it starts working?

    But I am glad you found a way to get it working!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘submit button not working when do_shortcode('[gravityform id="'.$form_id.'"’ is closed to new replies.