AnonymousInactive
Hello Trevor,
I have added a link to the script in my header : https://cdnjs.cloudflare.com/ajax/libs/datepicker/1.0.10/datepicker.min.js
But again I am getting this in console :
Uncaught TypeError: Cannot read property ‘extend’ of undefined
at datepicker.min.js:10
at datepicker.min.js:10
at datepicker.min.js:10
Uncaught TypeError: t.datepicker is not a function
at HTMLInputElement.<anonymous> (search-filter-build.min.js?ver=2.5.2:2)
at Function.each (jquery.js?ver=1.12.4-wp:2)
at n.fn.init.each (jquery.js?ver=1.12.4-wp:2)
at HTMLFormElement.addDatePickers (search-filter-build.min.js?ver=2.5.2:2)
at HTMLFormElement.init (search-filter-build.min.js?ver=2.5.2:2)
at HTMLFormElement.<anonymous> (search-filter-build.min.js?ver=2.5.2:2)
at Function.each (jquery.js?ver=1.12.4-wp:2)
at n.fn.init.each (jquery.js?ver=1.12.4-wp:2)
at n.fn.init.e.exports [as searchAndFilter] (search-filter-build.min.js?ver=2.5.2:1)
at HTMLDocument.<anonymous> (search-filter-build.min.js?ver=2.5.2:1)
Did you had any experience with this kind of errors before?
Best wishes, Klime.
AnonymousInactive
Hello,
I just purchased the plugin and tried to make my first search form.
I am getting the datepicker is not function error, very strange :
Uncaught TypeError: t.datepicker is not a function
at HTMLInputElement.<anonymous> (search-filter-build.min.js?ver=2.5.2:2)
at Function.each (jquery.js?ver=1.12.4-wp:2)
at n.fn.init.each (jquery.js?ver=1.12.4-wp:2)
at HTMLFormElement.addDatePickers (search-filter-build.min.js?ver=2.5.2:2)
at HTMLFormElement.init (search-filter-build.min.js?ver=2.5.2:2)
at HTMLFormElement.<anonymous> (search-filter-build.min.js?ver=2.5.2:2)
at Function.each (jquery.js?ver=1.12.4-wp:2)
at n.fn.init.each (jquery.js?ver=1.12.4-wp:2)
at n.fn.init.e.exports [as searchAndFilter] (search-filter-build.min.js?ver=2.5.2:1)
at HTMLDocument.<anonymous> (search-filter-build.min.js?ver=2.5.2:1)
The site is not live and it’s under development : http://zlostor.orion.com.mk/
And another thing, when the results are displayed, they are list of events that were happening in last 7 years, together with map of the location where they happened. There will be a map on the top of the search results and I already purchased WP Google Maps Pro plugin, is there a way I can handle a XML with results query to the map so the markers can appear on it? I will need just name, longitude, langitude and permalink to be sent to the map (they are all in the post as custom fields) as XML/CSV or whatever, is there some possibility with your plugin?
Best wishes, Klime.
AnonymousInactive
Hi Ross,
I tried this (and many other things) :
(function ( $ ) {
"use strict";
var searchForm = {};
function resetForm(){
searchForm.resetForm(false);
}
$(document).on("sf:init", ".searchandfilter", function(e, data){
searchForm = data.object;
console.log("S&F JS initialised");
});
$(document).ready(function ($) {
const depts = document.querySelectorAll('#departements path');
const results = document.querySelector('.search-filter-results');
const villes = document.querySelector('.sf-field-taxonomy-ville');
const services = document.querySelector('.sf-field-taxonomy-service');
const reset = document.querySelector('.sf-field-reset');
function handleDeptClick(e) {
resetForm();
depts.forEach(dept => {
dept.classList.remove('active');
});
const deptPath = e.target;
const inputRadioNull = document.querySelector('.sf-item-0 input.sf-input-radio');
inputRadioNull.checked = true;
const departementNum = deptPath.className.baseVal.split('-').pop();
deptPath.classList.add('active');
const inputRadioSelector = <code>input.sf-input-radio[value="${departementNum}"]</code>;
const inputRadio = document.querySelector(inputRadioSelector);
if ( inputRadio.checked === false ) {
inputRadio.checked = true;
}
while(results.firstChild)
results.removeChild(results.firstChild);
$('.searchandfilter').submit();
}
depts.forEach(dept => {
dept.addEventListener('click', handleDeptClick);
});
});
}(jQuery));
The sf:init
event seems to be triggered. My console says : “S&F JS initialised”
I always have an error on this line :
if ( inputRadio.checked === false ) {
because inputRadio is null (cause it’s not in the DOM anymore, the resetForm function doesn’t seem to work).
Uncaught TypeError: Cannot read property 'checked' of null
David
Posts are generally private if the poster is passing information of no relevance to other users or passing private logins or contact details, or site details that are private. It is the nature of this forum that it is used by developers, who would not want to make public details of their clients sites.
My experience is that, whilst a description of a problem often looks like one you might be experiencing, when examined is a different issue.
So, that thread you refer to I have made public so you can read it.
Here is another thread where the user found a way to resolve it (no posts were private):
https://support.searchandfilter.com/forums/topic/uncaught-typeerror-cannot-read-property-replace-of-undefined-3/
In this one, they had an incorrect version of jQuery loading from a different plugin:
https://support.searchandfilter.com/forums/topic/uncaught-typeerror-cannot-read-property-replace-of-undefined-2/
Do they help?
AnonymousInactive
Hi. i’v fix all the error appear in console,
still heve an error on:
search-filter-build.min.js?ver=2.5.0:2 Uncaught TypeError: t.datepicker is not a function
at HTMLInputElement.<anonymous> (search-filter-build.min.js?ver=2.5.0:2)
at Function.each (jquery.js?ver=1.12.4-wp:2)
at a.fn.init.each (jquery.js?ver=1.12.4-wp:2)
at HTMLFormElement.addDatePickers (search-filter-build.min.js?ver=2.5.0:2)
at HTMLFormElement.init (search-filter-build.min.js?ver=2.5.0:2)
at HTMLFormElement.<anonymous> (search-filter-build.min.js?ver=2.5.0:2)
at Function.each (jquery.js?ver=1.12.4-wp:2)
at a.fn.init.each (jquery.js?ver=1.12.4-wp:2)
at a.fn.init.e.exports [as searchAndFilter] (search-filter-build.min.js?ver=2.5.0:1)
at HTMLDocument.<anonymous> (search-filter-build.min.js?ver=2.5.0:1)
AnonymousInactive
I’ve installed the plugin and pasted the code but it didn’t change anything. Maybe the synthax is wrong. I also tried as said by the plugin :
jQuery(document).ready(function( $ ){
"use strict";
$(document).on("sf:ajaxfinish", ".searchandfilter", function(){
$('.visuels-realisations').slick('unslick');
$('.visuels-realisations').slick(getSliderSettings());
});
});
But didn’t work either.
Here’s the error from the console :
Uncaught TypeError: Cannot read property ‘unslick’ of undefined
at a.fn.init.$.fn.slick (slick.js?ver=1:3005)
at HTMLFormElement.<anonymous> (?_sft_categories-projets=ouvrages-publics:334)
at HTMLDocument.dispatch (jquery.js?ver=1.12.4:3)
at HTMLDocument.r.handle (jquery.js?ver=1.12.4:3)
at Object.trigger (jquery.js?ver=1.12.4:3)
at Object.a.event.trigger (jquery-migrate.min.js?ver=1.4.1:2)
at HTMLFormElement.<anonymous> (jquery.js?ver=1.12.4:3)
at Function.each (jquery.js?ver=1.12.4:2)
at a.fn.init.each (jquery.js?ver=1.12.4:2)
at a.fn.init.trigger (jquery.js?ver=1.12.4:3
AnonymousInactive
here is the error that is happening:
`Uncaught TypeError: n.$ajax_results_container.find(…).searchAndFilter is not a function
at HTMLFormElement.updateResults (search-filter-build.min.js?ver=2.3.3:2)
at Object.success (search-filter-build.min.js?ver=2.3.3:2)
at j (jquery.js?ver=1.11.2:2)
at Object.fireWith [as resolveWith] (jquery.js?ver=1.11.2:2)
at x (jquery.js?ver=1.11.2:4)
at XMLHttpRequest.b (jquery.js?ver=1.11.2:4)
AnonymousInactive
Also the plugin gives me this:
search-filter-build.min.js?ver=2.1.2:1 Uncaught TypeError: t(…).searchAndFilter is not a function
Hi
The problem is happening because jQuery is being loaded twice (I can see a whole bunch of javascript errors in the console in Firebug). This is not allowed (or at least is very bad practice). Please read this post:
https://support.searchandfilter.com/forums/search/Uncaught+TypeError+searchAndFilter/
From what I can see, it is the theme js files that are the cause. There is nothing we can do about that. You must contact the theme author and let them have a look. It is why I have stopped using themes that are not on the WordPress theme repository (and even then only if they have recently updated it and the feedback and support looks OK), or the one theme framework I DO know is OK for custom made themes.
I can see if I look at the JS console that you have a JS error:
Uncaught TypeError: t(...).searchAndFilter is not a function
This is 99% of the time because someone is loading a second copy of jQuery on their website, which breaks dependencies and therefor jQuery plugins like the one S&F uses.
Thanks