Skip Navigation

[Escalated to 2nd Tier] AJAX does not work when uploading additional files to a file upload field.

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.

This topic contains 10 replies, has 2 voices.

Last updated by Luo Yang 3 weeks ago.

Assigned support staff: 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

Luo Yang
Supporter

Languages: English (English ) Chinese (Simplified) (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

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

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

Luo Yang
Supporter

Languages: English (English ) Chinese (Simplified) (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

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

Luo Yang
Supporter

Languages: English (English ) Chinese (Simplified) (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

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

#1706259

Luo Yang
Supporter

Languages: English (English ) Chinese (Simplified) (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

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

Luo Yang
Supporter

Languages: English (English ) Chinese (Simplified) (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

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

Luo Yang
Supporter

Languages: English (English ) Chinese (Simplified) (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

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