Skip Navigation

[Resolved] Slide Stopped Working

This thread is resolved. Here is a description of the problem and solution.

Problem: A slider with automatic pagination and AJAX updates stopped working after updating to Maps 1.5.

Solution: Update to Maps 1.5.1 to fix this issue.

This support ticket is created 5 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 14 replies, has 2 voices.

Last updated by aaronM-9 5 years, 9 months ago.

Assisted by: Christian Cox.

Author
Posts
#948685
temp1.jpg
temp2.jpg
temp3.jpg
temp4.jpg
temp5.jpg

I had a view on the home page of my website that was displaying about 8 pages set on an automatic AJAX advance every 10 seconds, with pagination controls at the bottom. I added a link (as a button) to the view and now only the first page is viewing, it's not auto-advancing, and there are no pagination controls. I deleted the button and reverted back but it still isn't working. I also set the limit to 2 pages instead of 1 and it successfully displays two but when going back to 1 it still does not act as if there are any other posts to display. I've attached some screenshots to help. I must be doing something dumb, right? I just can't figure out what it is. This should be an easy one, sorry. Thanks for any help.

- Aaron

#948716

Not sure about this one, the View looks okay. Can you enable debug mode in Toolset > Settings > Frontend Content and test again? I'm not sure how to access this page when logged in, so I wasn't able to test it myself. If you're able to get the debug panel open, toggle all the sections open and copy + paste the results here for me to review.

#948720

Having trouble getting the debug mode to work. I ticked the box that enables it and added my website to the list of exceptions to popup blocking, but nothing happens.

The best way to test while logged in is to just have two browsers open - one logged in and one not. The website automatically redirects you a different page if you're logged in.

Also, since the site is live I'm hesitant to leave debug mode on for very long, FYI.

- Aaron

#948729

Right, the problem is that debug mode only works for logged-in Users. It's not meant to be shown to guests, so I'm not sure how to get it to show up on this login page. As an alternative, you could take this View and place it somewhere else on the site that a logged-in User can access.

#949156
temp1.jpg
temp2.jpg
temp3.jpg
temp4.jpg

Good idea - I put the view onto the following logged-in page: hidden link

Attached are screenshots from the debug.

Does debug mode put that popup window for all logged-in users or just admins? If the former and you want to test yourself, just be sure to only turn it on long enough to refresh the page. Thanks.

- Aaron

#949248
Screen Shot 2018-07-17 at 11.43.20 AM.png

Okay I thought maybe this View had become corrupted somehow, so I recreated it from scratch: hidden link

I added that View to the test page and it has the same problem - no automatic advance. So I was digging deeper and I found something strange in the View's Loop Output. Check this screenshot. Any idea why this form tag would be appearing here? I replaced my test View with the original View and found the same issue. Neither View's loop contains this Form tag. It's not in the page source, so that indicates it's injected with JavaScript somehow. I wasn't able to pin it down quickly and wondered if this was something you recognized.

#949274

Interesting - The only custom JS code I've added related to maps is pasted below, but it's only set to update certain form fields if they exist, and it's only triggered when a Google Map call is made. I also wouldn't have named a form ID by that. Usually when I've been making custom things I've started with the prefix "be_" and I wouldn't have manually tried to force anything with a toolset name. Maybe because that form has no closing tag is why it's fouling up the view output.

Could the following line be causing the form to get created?

$("input.js-toolset-google-map").on( "geocode:result", function( event, result ){

( function( $ ) {
 
    $( document ).ready( function(){
 
        $("input.js-toolset-google-map").on( "geocode:result", function( event, result ){
 
            var addressComponents = result.address_components;

            var coordinates = result.geometry.location.lat() + ', ' + result.geometry.location.lng();
            x = document.getElementsByClassName("be_geo_coordinates");
            y = x[0].id;
            document.getElementById(y).value = coordinates;

var targetDate = new Date();
var timestamp = targetDate.getTime()/1000*60
var apikey = '***';
var apicall = '<em><u>hidden link</u></em>' + coordinates + '&timestamp=' + timestamp + '&key=' + apikey;

var xhr = new XMLHttpRequest() // create new XMLHttpRequest2 object
xhr.open('GET', apicall) // open GET request
xhr.onload = function(){
    if (xhr.status === 200){ // if Ajax request successful
        var output = JSON.parse(xhr.responseText) // convert returned JSON string to JSON object
        console.log(output.status) // log API return status for debugging purposes
        if (output.status == 'OK'){ // if API reports everything was returned successfully
             console.log(output)
			x = document.getElementsByClassName("be_geo_timezone_id");
			y = x[0].id;
			document.getElementById(y).value = output.timeZoneId;
			x = document.getElementsByClassName("be_geo_timezone_name");
			y = x[0].id;
			document.getElementById(y).value = output.timeZoneName;
			document.getElementById('be_geo_timezone_name_label').innerHTML = output.timeZoneName;
        }
    }
    else{
        alert('Request failed.  Returned status of ' + xhr.status)
    }
}
xhr.send() // send request

 
            $.each( addressComponents, function( index, value ){
 
                if ( addressComponents[ index ].types[0] == "street_number" ) {

			var element_value = addressComponents[ index ].long_name;
			x = document.getElementsByClassName("be_geo_house");
			y = x[0].id;
			document.getElementById(y).value = element_value;

                } else if ( addressComponents[ index ].types[0] == "route" ) {

			var element_value = addressComponents[ index ].long_name;
			x = document.getElementsByClassName("be_geo_street");
			y = x[0].id;
			document.getElementById(y).value = element_value;

                } else if ( addressComponents[ index ].types[0] == "locality" ) {

			var element_value = addressComponents[ index ].long_name;
			x = document.getElementsByClassName("be_geo_city");
			y = x[0].id;
			document.getElementById(y).value = element_value;

                } else if ( addressComponents[ index ].types[0] == "administrative_area_level_1" ) {

			var element_value = addressComponents[ index ].short_name;
			x = document.getElementsByClassName("be_geo_state");
			y = x[0].id;
			document.getElementById(y).value = element_value;

                } else if ( addressComponents[ index ].types[0] == "postal_code" ) {

			var element_value = addressComponents[ index ].short_name;
			x = document.getElementsByClassName("be_geo_postalcode");
			y = x[0].id;
			document.getElementById(y).value = element_value;

                } else if ( addressComponents[ index ].types[0] == "country" ) {

			var element_value = addressComponents[ index ].short_name;
			x = document.getElementsByClassName("be_geo_country");
			y = x[0].id;
			document.getElementById(y).value = element_value;

                }
 
            } );
 
        } );
 
    } );
 
})( jQuery );
#949346

Okay no, this isn't causing the form tag and I'm seeing it injected in other Views on my local site so it must be injected by the Maps plugin for a reason I'm not aware of. I think the next step is an isolation test, deactivate plugins except for Toolset and activate a default theme, then test again. If you have a test environment set up I can do that, or I will need a new clone of your site to test locally. I'm not able to recreate the issue on the old copy I already have access to. Let me know how you want to proceed.

#949347

Hi Christian,

Shutting off plugins is going to be difficult because the site has been launched. Although I'm not getting much traffic, I never know when somebody is going to connect. Should I make a new duplicator package?

- Aaron

#950289

A new duplicator package will be fine. First, please make sure you're up-to-date on Maps and all the other Toolset plugins. I just found out today there was a bug in Maps 1.5 that caused problems with pagination in some Views, and I'd like to confirm this isn't also responsible for your issue. If not, please provide a new package download link here in the private fields.

#950297

Also - confirmed the issue is still present despite this morning's upgrade to the newest versions of each plugin.

#950491

Okay thanks I have the Duplicator package now, I'll run some additional tests and update you soon.

#950495

Test page is working now on the live site! Maybe there was a cached file causing a problem. It's advancing correctly for me. Can you clear cache and check again?

#950512

You're right! It looks like it's working on the front page, too. I didn't realize because the pagination controls aren't showing up. I'll look into that now to make sure we didn't remove them while troubleshooting. Maybe it was that bug that got fixed after all.

- Aaron

#950513

I confirmed the pagination control is now working as well - it had been removed while troubleshooting. Unless you did anything differently, I think it must have been that bug you mentioned coming from Maps. The issue seems to be fully resolved now. Thanks for the help.

- Aaron

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.