justauser034675
Forum Replies Created
-
Forum: Plugins
In reply to: [Address Autocomplete via Google for Gravity Forms] JS error with v1.3.5Hi,
the error above “consol.logo” is still present – the plugin hasnt been updated
Uncaught TypeError: console.logo is not a function
at PCAFE_AAC_Frontend.init_autocompleteThanks
Update – it isn’t QM doing this…. Not sure what though….
Forum: Plugins
In reply to: [Address Autocomplete via Google for Gravity Forms] JS error with v1.3.5Hi,
I’m waiting for the fix for “Uncaught TypeError: console.logo is not a function” so that I can test correctly for previous problem and then reclone with all updates and resend you a link.
Do you know when the above will be fixed?
thanks very muchForum: Plugins
In reply to: [Address Autocomplete via Google for Gravity Forms] JS error with v1.3.5Great, do you know when the update with this fix will be released?
Forum: Plugins
In reply to: [Address Autocomplete via Google for Gravity Forms] JS error with v1.3.5sorry I wasn’t clear.
the error is your code “console.logo” should be “console.log” 😂
I did send an email and you said you would implement a fix but I never heard back. It’s also hard to identify if the fix was added to the recent update as the changelog doesn’t give specific details on what was actually fixed, just says js errors 🙂
thanks.
Hi,
I believe if you enable script_debug in wp config and view the js console in browser dev tools whilst editing a page you will see this.
Please let me know if this doesn’t recreate it for you
Thanks
Hi,
I think we discussed this a month or 2 ago in email support also, do you know when you’ll be releasing the next update?
Thanks
Will caching break the functionality?
Do you have an email address I can send a dev version of the site so you can see error?
Do you have an email address I can send url directly to so I don’t post it here?
fyi – here’s what console ai suggests 🙂
“Uncaught TypeError: Cannot read properties of null (reading ‘addEventListener’)”Explanation Understanding the problem
The error “Uncaught TypeError: Cannot read properties of null (reading ‘addEventListener’)” occurs because <code class=” “>aac_input is <code class=” “>null when the code tries to attach an event listener to it. This happens because <code class=” “>document.getElementById(aac_id) cannot find an element with the specified <code class=” “>aac_id in the DOM. Consequently, the <code class=” “>addEventListener method is called on a <code class=” “>null object, leading to the observed error. The value of <code class=” “>aac_id depends on the type of field, but it seems that for at least one field, no element with the corresponding ID exists on the page at the time this script executes.How to verify
To verify this, you can:
- <strong class=” “>Inspect the HTML: Check your HTML to ensure that there is an input element with the ID that <code class=” “>aac_id is supposed to have when the error occurs. If the <code class=” “>field[‘type’] is <code class=” “>address, look for an element with ID like <code class=” “>inputId + “_1”. Otherwise, look for an element with ID equal to the value of the <code class=” “>inputId variable. You can use the “Elements” tab in Chrome DevTools to do this.
- <strong class=” “>Check script execution timing:Â Verify that the JavaScript code is executed after the relevant HTML elements have been fully loaded and rendered in the DOM. It’s possible the script is running before the input element exists.
Suggested fix
Ensure that the input element with the expected ID exists in the DOM <em class=” “>before the script tries to access it. Here are a few ways to fix this:
- <strong class=” “>Ensure element exists: Double-check that the element with the ID defined by <code class=” “>aac_id is actually present in your HTML. If it’s missing, add it. Make sure that the input element with the ID <code class=” “>aac_id is present in the DOM when this code is executed.
- <strong class=” “>Verify ID generation: If the element should exist, verify the logic that generates <code class=” “>inputId and subsequently <code class=” “>aac_id. Ensure that the correct ID is being assigned to the target input element.
- <strong class=” “>Wait for DOM to load:Â If the element is present but the script runs before it’s loaded, wrap your code in a DOMContentLoaded event listener
document.addEventListener('DOMContentLoaded', function() {
// Your code here
if( field['type'] == 'address' ) {
var aac_id = inputId + "_1";
} else {
var aac_id = inputId;
}
var aac_input = document.getElementById(aac_id);
if (aac_input) { // Add a check to make sure aac_input is not null
aac_input.addEventListener( "keydown", function (event) {
if (event.key === "Enter") {
event.preventDefault();
}
});
var autocomplete = new google.maps.places.Autocomplete(
aac_input,
{
options,
}
);
} else {
console.error("Element with ID '" + aac_id + "' not found.");
}
});Actually, it’s unrelated to iframe. It’s because of “Load with Async” set to yes. If I do a hard refresh of the page – this creates an error. It’s the same problem as reported here: https://ww.wp.xz.cn/support/topic/google-maps-javascript-api-has-been-loaded-directly-without-loadingasync-3/
Hi @kaisarahmmed ,
If we enable it, we get a js error stating: “Uncaught TypeError: Cannot read properties of undefined )reading ‘Autocomplete’)”
thanks
Just wondering, further to this…
Not sure if this is possible but on paginated forms, is it possible to only load it on the page of the form where its used. Might be a bit of a non-starter I know – but thought I’d ask… 🙂
thanks
@kimmyx this is still an issue, I know its minor but it clags up logs in my dev sites. Do you have an ETA on this?
thanks
thanks John, you’re right with the recursion conclusion. No need to check your code, if query monitor didn’t burn out the memory something else would have 😂
FYI the block I’m using is placed inside a Kadence element of type template. It is set to replace the post content template. So there’s no risk to frontend. However on the backend the problem arose because rest checks weren’t triggering my default preview id so I think it was attempting to load itself, as kadence element is a cpt. I think I’ve solved it with the addition of the is_admin() check.