Skip Navigation

[Resolved] Repeating image fields only save the last image

This support ticket is created 5 years 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
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 9 replies, has 2 voices.

Last updated by Luo Yang 5 years ago.

Assisted by: Luo Yang.

Author
Posts
#1399837

I am trying to update a custom post type created with Toolset Types. It has a repeating image field on it so that we can put a photo gallery on each product. Here's an example:
hidden link (see the Gallery at the bottom)

Recently, a bug has started where these add/edit screens only save the last photo in the gallery, and all the rest of them are lost. For example, we wanted a few photos in this gallery, but it won't save more than the last photo:
hidden link

We actually have some updates to make to the PM1450 (the first link above), but as you could see it has 7 gallery photos, and we do not want to lose 6 of them when we click on the Update button. This bug is preventing us from making other updates to the page because we don't want to lose the photo gallery images it has now.

On the edit screen, you can upload multiple photos and rearrange them. But the act of clicking the Update button results in only the last photo being saved. We are actually wondering if this issue is related to this known issue:
https://toolset.com/errata/repeating-image-and-file-fields-produce-php-warnings-with-wordpress-5-3/

#1400349

Hello,

It seems to be similar problem, please try these:
Enable PHP debug mode, test again, check if there are similar PHP errors in your website
https://toolset.com/documentation/programmer-reference/debugging-sites-built-with-toolset/#php-debugging

And the issue you mentioned above is fixed in next version of Types plugin 3.3.8, which is under QA status, will be released soon

#1400857

Hi Luo Yang,

Our error_log file is filled with that error about expecting an array or object, but hasn't shown up since December 3rd. I just tried updating a post again, and it didn't log an error even though the problem persisted.

However, I just noticed the follow javascript error when loading the page:

bundle.add_or_edit.js?ver=3.3.7:1 Uncaught TypeError: Cannot read property 'getCurrentPostId' of null
at Module.<anonymous> (bundle.add_or_edit.js?ver=3.3.7:1)
at n (bundle.add_or_edit.js?ver=3.3.7:1)
at bundle.add_or_edit.js?ver=3.3.7:1
at bundle.add_or_edit.js?ver=3.3.7:1
(anonymous) @ bundle.add_or_edit.js?ver=3.3.7:1
n @ bundle.add_or_edit.js?ver=3.3.7:1
(anonymous) @ bundle.add_or_edit.js?ver=3.3.7:1
(anonymous) @ bundle.add_or_edit.js?ver=3.3.7:1

It is indicating that the error is coming out of:
hidden link

#1400879
#1400881

I would say it's not just that the backend doesn't show up... it's that not all of the images in the repeating image field are saved. The interface allows me to assign multiple images to a repeating image field, but it only saves the last one. If you look at the front end of the post after that, it truly only saved the last image. So it's not only that it doesn't show up in the backend, it gets lost when saving, and doesn't show on the front end either.

Posts that already have multiple images still work fine, and the first time you go to edit them, they DO show up (at least for me). But the moment you update something, all but the last one is lost.

#1401341

Hello,

For the JS errors:
bundle.add_or_edit.js?ver=3.3.7:1 Uncaught TypeError: Cannot read property 'getCurrentPostId' of null
at Module.<anonymous> (bundle.add_or_edit.js?ver=3.3.7:1)

It is a known issue of Toolset Types plugin, see our errata:
https://toolset.com/errata/when-using-classic-editor-on-posts-toolset-types-produces-javascript-errors/

And it is fixed in Types plugin 3.3.8, which is under QA status, will be released soon.

#1407265

Hello,

The JS errors are gone, but I'm still not able to save more than one image even after updating to 3.3.8!

Now that the JS errors are gone, I see no clues as to why this could be happening.

#1407299
Screen Shot 2019-12-12 at 11.07.28 AM.png

What does this mean?

Repeatable fields are currently not supported inside RFG - the field can only have one value inside a RFG

Is there something setup causing my Repeating image field to NOT actually allow it to save more than one?

#1407551

I believe I have solved a big part of the mystery. The Elegant Elements for Fusion Builder plugin was the culprit creating a conflict with Toolset.

hidden link

When Elegant Elements is on, we cannot save more than one image in a repeating field. As soon as I turn it off, I can do it again.

Maybe you can figure out what the conflict is and see if it's something fixable on your end. I'm not sure who the responsibility to fix something will fall to, or if you will just mention this plugin in your incompatibility list. It's an add on for Avada, and I know Toolset probably wants to play nice with Avada. I just don't know if you'll tailer to the needs of add-on's for Avada. Please let me know!

Thanks.

#1407731

Thanks for the details, since it is a compatibility issue with Elegant Elements for Fusion Builder plugin, please provide a copy of your website in below private message box, you can put the package in your own google drive disk, and share the link. I need to duplicate the same problem in a fresh WordPress installation, thanks
https://toolset.com/faq/provide-supporters-copy-site/