Skip Navigation

[Resolved] Split: Unable to submit form – form not redirecting

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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 10 replies, has 2 voices.

Last updated by himanshuS 1 year, 10 months ago.

Assisted by: Minesh.

Author
Posts
#2538643

Minesh,

Thank you for solving part 1 of the issue. But the main issue is still there.

I mentioned that in the second scenario where form is submitted is user is not directed to the next page.

All backend processing happens just fine but the page does not follow the guidance for redirection on toolset form.

You can test this at hidden link

This is happening for most forms and I am still getting the following error in console -
GET hidden link net::ERR_NAME_NOT_RESOLVED
hidden link
GET hidden link net::ERR_NAME_NOT_RESOLVED

#2538673

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

It seems you have multiple hooks added to for the same form ID and hence it could not be working. Fortunately - Toolset offers hook
"cred_success_redirect" that we can use to redirect the form after submit.

I've added the following hook to redirect your form to "Custom Code" section offered by Toolset with the code snippet "redirect-form-after-submit":

add_filter('cred_success_redirect', 'func_redirect_to_career_growth_page',999,3);
function func_redirect_to_career_growth_page($url, $post_id, $form_data) {
    if ($form_data['id']==49449) {
    
      $host = isset($_SERVER['HTTPS']) ? "https" : "http";
      $actual_link =  $host."://$_SERVER[HTTP_HOST]/career-growth-timeline/";
      return $actual_link;
    }
  
    return $url;
}

I can see its working as expected.

#2538679

Minesh,

Why would adding multiple hooks to the same ID have an impact if I don't touch the cred_success_redirect hook?

This was working before and I have multiple forms with hooks and even custom redirects. Can you tell me the reason why the form level redirect(which is a core functionality) does not work?

Your solution is a workaround that would require me to make changes on 40+ forms as this issue is happening on multiple forms.

I would like to know what is causing this issue so we can get the bottom of the problem and prevent it in the future.

#2538691

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

So then first of all I see that you have added many custom scripts and you are using number of third party plugins.

In order to minimize the cause of the issue and to ensure there is no conflict between third-party plugins or theme you are using with Toolset:

Could you please try to resolve your issue by deactivating all third-party plugins as well as the default theme to check for any possible conflicts with any of the plugins or themes? Please try to check with minimum install Toolset plugins + default theme.
- Do you see any difference?

Also, I see as soon as I submit the button "Next" I see some processing dots - how you added those?

#2539073

I have checked the issue by removing 3rd party plugins and default theme. That is not a problem.

The error in inspect happens when toolset plugins are enabled. Not the other way around.

Spinner shows because I am using AJAX and this script: custom_redirect_message.php. I disabled it and tested without, still the same issue.

IMPORTANT: the issue is happening on multiple forms where I am using the toolset form level redirection. It seems like, for some reason, the form is picking up the redirection setting in the toolset form. If I a not using toolset for redirection and just showing a message, the form works just fine.

What would cause such setting to be overridden? I have checked the custom code snippets, but no cred_success_redirect is global i.e. it only works on specific forms. All the forms where it does not work are failing.

I am trying to disable the custom code snippets in wp-config but it does make any changes.

I am adding the following code at the bottom of the file:
define( 'TOOLSET_DISABLE_CODE_SNIPPETS', true );
define( 'TOOLSET_DISABLE_CODE_SNIPPETS_GUI', true );

But it does disable the snippets or hides the GUI.

<?php
define( 'WP_CACHE', true ); // Added by WP Rocket

/**
 * The base configuration for WordPress
 *
 * The wp-config.php creation script uses this file during the
 * installation. You don't have to use the web site, you can
 * copy this file to "wp-config.php" and fill in the values.
 *
 * This file contains the following configurations:
 *
 * * MySQL settings
 * * Secret keys
 * * Database table prefix
 * * ABSPATH
 *
 * @link https://codex.wordpress.org/Editing_wp-config.php
 *
 * @package WordPress
 */
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define( 'DB_NAME', 'name' );
/** MySQL database username */
define( 'DB_USER', 'name' );
/** MySQL database password */
define( 'DB_PASSWORD', 'name' );
/** MySQL hostname */
define( 'DB_HOST', 'name' );
/** Database Charset to use in creating database tables. */
define( 'DB_CHARSET', 'name' );
/** The Database Collate type. Don't change this if in doubt. */
define( 'DB_COLLATE', '' );
/**
 * Authentication Unique Keys and Salts.
 *
 * Change these to different unique phrases!
 * You can generate these using the {@link <em><u>hidden link</u></em> WordPress.org secret-key service}
 * You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
 *
 * @since 2.6.0
 */
auth details removed
/**
 * WordPress Database Table prefix.
 *
 * You can have multiple installations in one database if you give each
 * a unique prefix. Only numbers, letters, and underscores please!
 */
$table_prefix = 'wp_';
ini_set('log_errors',FALSE);
ini_set('error_reporting', E_ALL);
ini_set('error_log', dirname(__FILE__) . '/error_log.txt');
define('DISABLE_WP_CRON', true);
/* That's all, stop editing! Happy publishing. */
/** Absolute path to the WordPress directory. */
if ( ! defined( 'ABSPATH' ) ) {
	define( 'ABSPATH', dirname( __FILE__ ) . '/' );
}
/** Sets up WordPress vars and included files. */
@include_once('/var/lib/sec/wp-settings-pre.php'); 
require_once ABSPATH . 'wp-settings.php';
define( 'TOOLSET_DISABLE_CODE_SNIPPETS', true );
define( 'TOOLSET_DISABLE_CODE_SNIPPETS_GUI', true );
// Enable WP_DEBUG mode
define( 'WP_DEBUG', true );
// Enable Debug logging to the /wp-content/debug.log file
define( 'WP_DEBUG_LOG', true );
@include_once('/var/lib/sec/wp-settings.php'); 
#2539877

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

To remove code snippets from action you will have to disable those.

In addition to that it seems the access details are removed as you marked the parent ticket resolve.

In order to debug this issue I will require duplicator copy of your site. Can you please send me duplicator copy of your site.
=> https://toolset.com/faq/provide-supporters-copy-site/

I have set the next reply to private which means only you and I have access to it.

#2540561

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Can you please tell me what scrip you added to display dot progress bar and how exactly you enqueue "custom_redirect_message.php" file?

Also - do you confirm that the issue is not happening when you check with only Toolset plugins active with default theme? If yes:
- Have you tried to activate plugins one by one to check for any possible plugin/theme conflict?

If none of this helps - I will require duplicator copy of your site in order to debug this issue further. Can you please send me duplicator copy of your site.

More info:
=> https://toolset.com/faq/provide-supporters-copy-site/

I have set the next reply to private which means only you and I have access to it.

#2540647

It is added in custom code tab in toolset

Here is the snippet: custom_redirect_message.php

Here is the code for the script:

// Put the code of your snippet below this comment.
add_filter( 'gettext', 'custom_cred_redirection_msg_func', 20, 3 );
  
function custom_cred_redirection_msg_func( $translated_text, $text, $domain ) {
    if($text == 'Please Wait. You are being redirected...' && $domain = 'wp-cred'){
      global $post;
  if($post->ID == 88933) {
  $translated_text = "<strong style='font-size:20px;margin-right:5px;'>Importing Resumes...<br><img alt='' src='/wp-content/uploads/2022/01/Spinner.gif' width='140' height='16'/></strong>";
  }
   else {   
        $translated_text = "<strong style='font-size:20px;margin-right:5px;'>Processing...<br><img alt='' src='/wp-content/uploads/2022/01/Spinner.gif' width='140' height='16'/></strong>";
   }
    }
    return $translated_text;
}
?>

Issue is happening with only toolset plugin enabled. and it happens only for toolset forms. I have a non-toolset login form that redirects the user to the right page. So this is a toolset issue.

Duplicate copy of site:
I had the same chat with Waqar. Why do you need a duplicate copy when I have given you staging access with FTP details? You should be able to do everything there. I don't want you to copy the site on a local machine. You can troubleshoot in staging as much as you want.

#2540985

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

We require duplicator copy of your site to debug this further. We can not debug things on staging site or production sites with various debug Tools like xdebug and all other and moreover such deep debugging on staging or live is not recommended. Its almost impossible to debug things without those tools.

That is why can you please send me duplicator copy of your site and that is why even though we used to have access details we do not prefer to take site copy without user permission.

In order to debug this issue I will require duplicator copy of your site. Can you please send me duplicator copy of your site.
=> https://toolset.com/faq/provide-supporters-copy-site/

I have set the next reply to private which means only you and I have access to it.

#2541351

Please assign this ticket to Waqar. He told me he can work on the issue without making a copy of the site.

I also don’t understand why I am not able to disable custom snippets by making changes in the WP-config file.

If your documentation states that then why does it not work. I asked you about it and you just said disable it one by one. That’s a bad answer. You should look into why that doesn’t work and help me save time.

Also, this is big issue for us and you are not giving me the right answers, instead getting stuck in administrative stuff.

Please let Waqar handle this issue.

#2541495

My issue is resolved now.

I was able find a custom code snippet that was using redirect hook but was not returning a $url variable.