non_existent shortcode in loop

Handle missing uploaded files in ChronoForms.

Overview

The issue occurs when a file upload field is empty but still exists in the form data, sending an empty string instead of being treated as non-existent.
Use a switch action to check if the upload field is empty, then set the database value to a default filename like 'no_image.png' instead of relying on the non-existent data override.

Answered
ChronoForms v6
Fr Fredolino 05 Oct, 2019
Hi,

Under Actions / submit I have an upload files action (upload12).
After that:
Save Data (save_data30)
success: Loop event (loop_event31)
in the body from Loop event: Save Data (save_data44)

Everything works correctly.

There is only one problem with the upload files action.
When a photo is uploaded to the form, it is saved and displayed correctly.
If no photo is uploaded, then the filename "no_image.png" (which is already on the server) should be stored in the database in the "photo" column.

In save_data44 data override I try it with:
photo / {data: non_existent / no_image.png} / on insert

It does not work right. Why is not "non_existent"?

F.
Gr GreyHead 06 Oct, 2019
Hi Fredelino,

Is it non-existent - or is the variable in the data but empty? The tests are different.

Bob
he healyhatman 07 Oct, 2019
Answer
{data:field/default}
Default will ONLY be shown if the field DOES NOT EXIST, is DISABLED, or if it's a check/radio that's unchecked and "ghost value" is turned OFF. An enabled field with nothing in it will send an empty string, and default will not be shown. You need to use a switch.
This topic is locked and no more replies can be posted.