My File Upload field can apparently be hidden based on other field values, but the reverse does not seem to be true. I am not able to Show a field based on whether the File Upload field has a value.
Question
Question
Is there a way to hide a field until the File Upload has an attachment uploaded?
asked on April 9, 2020
1
0
Replies
replied on April 13, 2020
•
Show version history
Hi Mike,
You can put a hidden field on your form, fill it with the number of files, and then hide the upload field when the value is greater than 0.
You can get the number of files uploaded with JavaScript like this (q2 is my upload field):
$("#q2 .file-del").length
When a file is uploaded, it triggers the "fileuploadvalidate" event. You can fill the hidden field (q1 in my code) when a file is uploaded like this:
$(document).on("fileuploadvalidate", "#q2", function () { $("#q1 input").val($("#q2 .file-del").length).change(); });
FYI: fileuploadvalidate is not triggered in preview mode (since you're not actually uploading anything) so this will only work when you open up the process itself. For testing the field rule in a preview window you can replace "fileuploadvalidate" with "change".
2
0
replied on November 19, 2020
Thanks. I will try that.
0
0
You are not allowed to follow up in this post.