Doesn't work when opening ctools modal inside entity forms

Created on 28 February 2015, about 10 years ago
Updated 18 April 2023, almost 2 years ago

Hi there,

I have enabled address field autocomplete inside an article node form that has an image field with the media widget enabled.
When we upload a new image everything works great, but in case we need to edit the current uploaded photo we have to use the edit button.

The edit button is opening a cTool modal with the file entity form, but in reality is performing an Ajax request to fetch the data.
In firebug is we get the following error "TypeError: context.has is not a function".

I tracked down the error and it seems that when using modal windows context variable is a string (in my case context = #modalWindow) instead of an array. So in addressfield_autocomplete.js line 464 I changed:

if (context[0] !== undefined && context.has('[id^="addressfield-wrapper"]')) {

to

if (context[0] !== undefined && typeof context === 'array' && context.has('[id^="addressfield-wrapper"]')) {

I am not sure if that is a valid solution, reporting it here for more elaboration.

Thank you!

🐛 Bug report
Status

Closed: won't fix

Version

1.0

Component

Code

Created by

🇬🇷Greece apanag

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024