full disclosure, I am a newbie, I don't know what I don't know.
I'm using validators reasonably successfully in this page and others, but I cannot figure this one out.
There are 5 yes/no fields on my page and a hidden file column field.
if any of fields 1-4 is "yes", the file field is revealed.
I would to add a validator that checks that there is a file entered in the field, but only if any of fields 1-4 is yes.
I have everything up to the evaluation function, and the "check fields" portion of the evaluation function is straightforward (the same as the working hide/show logic - ugly but functional 😉) but I cannot fathom how to check that there is a file uploaded.
If anyone could help me with that logical test, I would be truly grateful!
I've cannibalised the built-in evaluation function used when making the file column required in studio ValidatorTrim(ValidatorGetValue(val.controltovalidate)) != ValidatorTrim(val.initialvalue)
but no joy. There doesn't seem to be much out there in google or chatGPT that understands file column - all the suggestions have been to check the length of the first element of files and my understanding is that a file column is a single binary object?
What method or technique do I use to check that the file column is not empty???
TYVM in advance!
You can use
$("#<your file column>_input_file").val();
if that is empty it's missing the file
Thank you. I was thinking along those lines, but it was specifically "check if file has data" that I was having trouble with. I couldn't figure out how to establish if a file column has data in it.
In the end, I used this as part of the logical test that worked - or rather, didn't fail!
document.querySelector("#my_field_file_name").textContent.length == 0
I can't testify to the elegance of the statement but it got me out of a hole 😁
Hi
my implementation here would be something like:
Fubar
69
Super User 2025 Season 1
oliver.rodrigues
49
Most Valuable Professional
Jon Unzueta
43