Skip Navigation

[Resolved] AJAX does not work when uploading additional files to a file upload field.

This support ticket is created 4 years, 4 months 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 11 replies, has 2 voices.

Last updated by Luo Yang 4 years, 1 month ago.

Assisted by: Luo Yang.

Author
Posts
#1694475

Tell us what you are trying to do?
1. We have a custom field "File Upload" with "Allow multiple instances of this field" selected.
2. We have a CREATION CRED form for submitting files and an Edit CRED form for editing files with AJAX enabled.
(The 2 forms are identical. The only difference is the "Submit" or "Update" button.)
3. We submit files using the CREATION form well.
4. When we try to upload additional files using EDIT form, the AJAX does not work. A full post back always happens.
5. Please advise.

#1697657

Hello,

The problem you mentioned above is abnormal, please check these:
1) Make sure you are using the latest version of Toolset plugins, you can download them here:
https://toolset.com/account/downloads/

2) In case it is a compatibility problem, please deactivate all other plugins, and switch to wordpress default theme 2020, deactivate all custom PHP/JS code snippets, and test again

3) Also check if there is any PHP/JS error in your website:
https://toolset.com/documentation/programmer-reference/debugging-sites-built-with-toolset/

#1703137
Toolset 2nd File Upload Issue.png

1. All of our Toolset plug-ins are up-to-date.
2. We disabled all the other plug-ins but still got the issue.
3. We tried to debug the Toolset EDIT form and got the errors in the attached screenshot.
Please note that this only happens if an additional file is uploaded to the custom field.
4. Please advise.

#1704669

Thanks for the details, I can see the problem you mentioned above, but the credentials you provided above is not an administrator account, please provide a database dump file of your website in below private message box, you can put the package files in your own google drive disk, share the link only, I need to test and debug it in my localhost, thanks

#1706081

I am downloading the files, will update here if there is anything found.

#1706259

The problem is in your custom JS codes, I have done below modifications in your website:
Edit post form "Application Edit Form":
hidden link
1) enable option "Use the WordPress Media Library manager for image, video, audio, or file fields "

2) Click "JS Editor", wrap your custom JS codes with below codes:

jQuery(document).on('cred_form_ready', function(){
...
});

Test it in front-end again:
hidden link

I can upload the images and submit the form without any problem, please test again, check if it is fixed, thanks

#1706431

Thanks for your suggestion.

We did use the "Use the WordPress Media Library manager for image, video, audio, or file fields." option to temporarily fix the issue in the past.

Due to our business requirement we are not allowed to use this option anymore and are forced to use the normal upload control.

Could you please advise?

#1706435

The reason why we are not allowed to use this "Use the WordPress Media Library manager for image, video, audio, or file fields." option is that this option allows users to upload files to WordPress without attaching them to the custom file upload field.

#1707625

I can duplicate the same problem in my localhost with a simple editing post form + repeating file field, and have escalated this issue, will update here if there is any news.

And I have tried it in your website again, it can upload the files and save the posts when I disable option "Use the WordPress Media Library manager for image, video, audio, or file fields.", can you confirm it in your website?

#1707907

Thanks, Luo.

The actual problem we are trying to solve here is that AJAX does not work when uploading additional files to a file upload field with disabled option "Use the WordPress Media Library manager for image, video, audio, or file fields."

When there is a patch for this please let us know.

#1708283

It has been confirmed as a bug, and our developers will work on it soon, I will update here if there is any news.

#1818469

It is fixed in the latest version of Toolset Forms plugin, you can download it here:
https://toolset.com/account/downloads/

Please test it and feedback if the problem is fixed, thanks