Trigger action on file upload

By: Enrico Brugnoni | Asked: 07/18/2023
ForumsCategory: General questionsTrigger action on file upload
Enrico Brugnoni asked 1 year ago

In formidable forms there is a very useful feature of "conditional logic", in which you can hide or show a filed based upon the value of another field.
Is it possible to do such a thing with a file upload?
For example, field 1 is shown when a file is uploaded in the file upload field.
(in general, if there is a way, even through php code, to see if a certain file upload field has a file uploaded)

Holger F replied 1 year ago

Hi, yes, that would be very good. Conditional logic in forms for upload field seems not to work out of the box.

1 Answers
Victor Font answered 1 year ago
Because file upload fields work with AJAX, the best approach would be to use jQuery to display the conditional field. On the form, customize the field's HTML to hide the field with CSS. Then create your jQuery snippet to monitor the AJAX.complete() event. When you determine that the file upload field AJAX executes, you can read the results and set the field to display with jQuery.show().
Holger F replied 1 year ago

Hi Victor, thank you for your answer. This is how it show work. I will ask someone to help me get this done with your great instruction. THX

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right