Skip Navigation

[Resuelto] "Submit this form without reloading the page (use AJAX)" – Not Working

This support ticket is created hace 3 años, 11 meses. 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.

Hoy no hay técnicos de soporte disponibles en el foro Juego de herramientas. Siéntase libre de enviar sus tiques y les daremos trámite tan pronto como estemos disponibles en línea. Gracias por su comprensión.

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)

Etiquetado: 

Este tema contiene 22 respuestas, tiene 3 mensajes.

Última actualización por Christian Cox hace 3 años, 7 meses.

Asistido por: Christian Cox.

Autor
Mensajes
#1869281
url-after-reload.PNG
only-warning-in-console.PNG
form-settings.PNG
form-settings.PNG
url-after-reload.PNG
only-warning-in-console.PNG

I don't know that this is a bug, but I believe I'm doing everything correctly and I'm not getting error messages.

I am trying to:
Submit a cred form without reloading the page.

I'm providing images which show the form settings, the only "info" mentioned in the console log (no errors or warnings reported). I have PHP error reporting on and there is nothing showing.

Bares mentioning that I was getting a notification for ob_end_flush() failed to send buffer.

And for that I used:
remove_action( 'shutdown', 'wp_ob_end_flush_all', 1 );
add_action( 'shutdown', function() {
while ( @ob_end_flush() );
} );

Link to a page where the issue can be seen:
I can't provide a link as it is restricted, but you can probably recreate the issue on the duplicate site I provided in my last bug report.

I expected to see:
An ajax save, without the page reload.

Instead, I got:
The page reloaded.

#1869445

Shane
Supporter

Idiomas: Inglés (English )

Zona horaria: America/Jamaica (GMT-05:00)

Hi Shawn,

Thank you for getting in touch.

We actually released new versions of our Toolset plugins.
What you can do is to download them and let me know if the issue still remains.
https://toolset.com/account/downloads/

Based on your debug information i'm seeing that you are running 1 version lower than our current ones.

Thanks,
Shane

#1869455

Just updated all extensions, tried again, same result regrettably: It saves the data, it puts up the "Post Saved" message in the green bar, it adds the URL extension, but it does all this after reloading the entire page.

#1870485

Shane
Supporter

Idiomas: Inglés (English )

Zona horaria: America/Jamaica (GMT-05:00)

Hi Shawn,

Can you send me the duplicator so that I can have a look at it here?

Thanks,
Shane

#1870619

The menu item M1D has the form I've been working with.

#1870853

Shane
Supporter

Idiomas: Inglés (English )

Zona horaria: America/Jamaica (GMT-05:00)

Hi Shawn,

I'm having some issues logging in on the duplicator, mainly because of the Google Captcha.

Can you let me know which plugin is loading the captcha so that I can disable it on the copy ?

Thanks,
Shane

#1870857

Not sure I understand. Sorry, I'm not very familiar with how Duplicator works. As for plugins, in general it could be related to "Wordfence Security", "Google Apps Log In", "HTTP headers to improve web site security", "White Label CMS", perhaps something else.

#1870865

Shane
Supporter

Idiomas: Inglés (English )

Zona horaria: America/Jamaica (GMT-05:00)

Hi Shawn,

Thank you I was able to get onto the backend.

Now i'm searching for the page on the backend that I can see the issue.

Can you point me in the direction for this so that I can have a look and provide some feedback for you.

Thanks,
Shane

#1870891

Sure, like I said the M1D in the main menu will take you to the a post where the form can be found and tested. The post form is titled "Model Form - Specs - Amplifiers" and is the most recently modified form. The content template the form is embedded in is "Series Model Set Prime Content Template" as is also the most recently modified. You may disregard the save and continue / save and go back buttons as they aren't currently tied to the submit button. Once ajax is working, I'll will add a simple on click function. I am using UIKit in place of bootstrap, but do not have bootstrap turned off globally as some forms use it. Eventually I will replace them.

#1872209

Shane
Supporter

Idiomas: Inglés (English )

Zona horaria: America/Jamaica (GMT-05:00)

Hi Shawn,

Thank you for the patience.

I'm checking on this for you however it issues seems to be isolated to only this page.

If you were to add the edit form to any of the other models it would work with AJAX.

The only difference I noticed was that there was an additional element in the URL "m-series"

So I suspect something on this page itself is causing the issue.

Thanks,
Shane

#1872295

You pointed out the URL "m-series" ... it's worth mentioning that this page used a permalink manager lite permastructure: %__series-model%/%model-type%/%model%

This is the slug of the series related to the model (Toolset Relationship) / the taxonomy slug / the model slug

Permalink Manager Lite code below...

function pm_toolset_related_posts_fields($default_uri, $native_slug, $post, $slug, $native_uri) {
	global $wpdb;

	// The permastructure tag should be formated like this
	// %__{relationship_slug}%, eg. %__posts_pages%

	// Do not change native permalinks
	if($native_uri) { return $default_uri; }


	// List of available relationship fields that should be replaced
	$relationship_fields = $wpdb->get_col("SELECT slug FROM {$wpdb->prefix}toolset_relationships");

	if(!empty($relationship_fields)) {
		foreach($relationship_fields as $field) {
			if(strpos($default_uri, "%__{$field}%") === false) { continue; }

			$relationship = $wpdb->get_row($wpdb->prepare("SELECT parent_id, child_id FROM {$wpdb->prefix}toolset_relationships as r LEFT JOIN {$wpdb->prefix}toolset_associations AS a ON r.id = a.relationship_id  WHERE slug = %s AND (parent_id = %d OR child_id = %d)", $field, $post->ID, $post->ID));

			if(!empty($relationship->parent_id)) {
				$related_post_id = ($post->ID != $relationship->parent_id) ? $relationship->parent_id : $relationship->child_id;
				$related_post = get_post($related_post_id);

				$default_uri = str_replace("%__{$field}%", $related_post->post_name, $default_uri);
			}
		}
	}

	return $default_uri;
}
add_filter('permalink_manager_filter_default_post_uri', 'pm_toolset_related_posts_fields', 5, 5);
#1872483

Sorry, to be clear that's the php for Toolset Relationships. Probably goes with out saying, but Taxonomy Slugs and Post Slugs are accounted for in the Permalink Manager Lite plugin itself.

#1876795

Hello, Shane is on holiday and I'm looking into his outstanding tickets. It looks like the Duplicator clone link has expired, and I don't have access to the one Shane was working with. Is it possible for you to reupload the clone archive and provide a new download link? I'll take a look and give you some feedback.

#1877055

Okay. I'll need a private post set in order to provide the link. On that note, I really think it would be wise to give your forum users the ability to tag private information in their posts so only staff could see it.

#1877131

Any URL you share in the forum is automatically hidden from public view for your security, so there's no need for additional private fields to share a download link securely. To make a URL public explicitly, add an "@" symbol before the URL.