Skip Navigation

[Resolved] Toolset form doesn't work on website homepage

This support ticket is created 3 years, 9 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 12 replies, has 2 voices.

Last updated by Christian Cox 3 years, 4 months ago.

Assisted by: Christian Cox.

Author
Posts
#1951641

Hi, I setup a Custom post type Create form on the homepage of my website with redirect to the same page on submit.

When I submit the form, it doesn't save the new post and it redirects to mydomain.com/?_tt=1613479124, where it displays the default Archive page of my CPT.

I tried changing the form redirect criteria, but I always get the same problem.

The CPT hasn't Archive (has_archive NO).

If I move the form to another page, it works fine.

To see the form on the frontpage you have to click on the Big Black Button.

Cheers

#1952207

Hi, I'm curious to know if the Content Toggle Panel could be causing some kind of interference here. Is it okay for me to try moving the Form outside of the Content Toggle Panel block temporarily to see if this solves the problem?

If that does not resolve the problem, I would like to temporarily deactivate some other plugins so I can test the form further.

Let me know if it's okay and I will continue testing.

#1952403

Hey, yes, you can make tests, this is still a DEV website. But I can tell you I've already tested without the toggle panel.

cheers

#1952513

Strange... for a temporary solution, I have turned on AJAX submissions for this form and the problem seems to be resolved. I'll continue to investigate and give you an update shortly.

#1952583

I don't see anything obviously set up incorrectly here. If it's okay with you, I'd like to create a clone of the site using the All-in-One WP Migration plugin and run some additional tests locally where I have the ability to monitor code execution. Let me know if that is okay, and I will get started.

#1952619

Yes, it's ok.

cheers

#1953827
Mobile.jpg
Captura2.PNG
Captura.PNG

Hi Christian, I've another problem with the same form. The image upload button ("Hacer Foto") is correctly styled on Desktop, but on the mobile I see the default input button style. I attach some screenshots.

cheers

New threads created by Christian Cox and linked to this one are listed below:

https://toolset.com/forums/topic/toolset-form-upload-button-styled-incorrectly-on-mobile/

#1954185

I've split your question about the mobile button styles into a separate ticket. I've also done some research and found a similar issue reported in the past: https://toolset.com/forums/topic/problem-with-astra-theme-taxonomies/

Our developers produced a workaround, which I have added as a custom code snippet in Toolset > Settings > Custom Code:

class tssnippet_Support_Submit_Forms_On_Archives {
      
    private $data = null;
    private $needs_restore = false;
      
    function __construct() {
        $this->maybe_save_postdata();
        add_action( 'wp', array( $this, 'maybe_restore_postdata' ) );
    }
      
    public function maybe_save_postdata() {
        if ( ! get_option( 'permalink_structure' ) ) {
            // Note that this will not work on sites with ugly permalinks :-/
            return;
        }
        if (
            isset( $_POST['_cred_cred_prefix_form_id'] )
            && isset( $_POST['_cred_cred_prefix_form_count'] )
        ) {
            $this->needs_restore = true;
            $this->data = $_POST;
            $_POST = array();
        }
    }
      
    public function maybe_restore_postdata() {
        if ( ! $this->needs_restore ) {
            return;
        }
          
        $_POST = $this->data;
    }
}
add_action( 'wp_loaded', 'tssnippet_load_support_submit_forms_on_archives' );
function tssnippet_load_support_submit_forms_on_archives() {
    new tssnippet_Support_Submit_Forms_On_Archives();
}

Now, I can submit the Form without AJAX as expected and I can see the post is published correctly. Please take a look and let me know if the problem is not resolved.

#1954317

Thnak you. Is it a Toolset bug or something that happens only on certain conditions?

#1954337

Actually it is both, it is a Toolset bug and it only happens in certain conditions. Here is the erratum: https://toolset.com/errata/php-warnings-and-a-wrong-redirect-when-submitting-a-toolset-form-from-a-views-wordpress-archive-page/

#1954743

My issue is resolved now. Thank you!

#2079299

FYI the permanent solution for this problem will be included in the upcoming Forms 2.6.10 release. Once you update, the workaround is no longer required.

#2125221

Forms 2.6.10 is now available.