[Résolu] Uncaught TypeError: wp.i18n is undefined (Colour Picker)
This support ticket is created Il y a 3 années et 10 mois. 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.
Aucun de nos assistants n'est disponible aujourd'hui sur le forum Jeu d'outils. Veuillez créer un ticket, et nous nous le traiterons dès notre prochaine connexion. Merci de votre compréhension.
Am running WP 5.6, Forms 2.6.5 and Types 3.4.5. Have noticed Uncaught TypeError: wp.i18n is undefined in inspection tools and reference to /wp-admin/js/color-picker.min.js?ver=5.6:2.
Hello. Thank you for contacting the Toolset support.
I do not see any evidence that the error belongs to Toolset.
Do you see the same error when Toolset plugins are deactivated?
- If no, Toolset does not have to do anything with error.
- If yes, What steps I should follow to see this error
The colorpicker is a CRED field. If I deactivate Forms or Types, it stands to reason I won't see the error!!
Just because the word "toolset" doesn't appear in the error, doesn't mean it's not triggered by something Toolset related. It could be that the i18n library is loaded too late or it's being called incorrectly - I have no idea that's why I've come to you.
I discovered this issue on a test site. The debug info is for a live (but insignificant site) where I've added a colorpicker field to a frontend form. You can see it here lien caché but you will need to be located in UK or US or tell me which country to unblock for access.
The curious thing is that when the field is the first on the form, the error shows. If it's below any others, the error doesn't show. I've also tested it using the 2020 theme and the same thing happens.
Ok - so basically, you have a custom post type having color picker field and then you have created a Toolset form for that post type and you see the mentioned error when you load the form on the frontend when color picker field is at top of the form, it color picker field is set 2nd or 3rd field, you do not notice this error - correct?
Minesh is on vacation for a couple of days. If you don't mind, I'll continue with you on this thread.
I was able to reproduce the issue on a clean install. You can check it here lien caché
For some reason, the color picker script is loaded before the i18n script if the first field in the form is a color picker. It does not happen on this page lien caché
Let me escalate this issue to our 2nd Tier for further analysis and get back to you.
This issue with the color field at the bottom of a form has been fixed and released in this week's update. Please make a full backup before updating the plugins.