Hi,
I have a requirement that I have a fileupload control where I need to set value as NULL whenever the validation fails. The validation I have added is to the fileupload field, so at present whenever I upload a wrong file there will be an error message displayed as I have added a validation specific to the field and manually I need to remove the file and upload the right one.
Instead my requirement is something like this,
a!fileUpload(
label" "File Upload",
value: local!fileId,
saveInto: local!fileId,
validations: {
if(fv!files.extension = "png",{"Error to display", a!save(local!fileId,null),"") /* Is something like this possible? or how we can achieve this */
}
The above scenario/question is applicable for a textfeild or any other fields also where we can change the value of the field if the validation fails.
Regards,
Balaji.R
)
Discussion posts and replies are publicly visible
rp_balaji said:And the condition here in the grid is whenever user uploads and document_id generated we have to hide the uploader column and show the document_id column as a link.
FYI, this won't work either - the document is only uploaded to a temporary and non-user-accessible system-protected folder up until the task is submitted, at which point the document is moved to its Target folder and becomes accessible to the user. Therefore you wouldn't be able to swap in download links immediately for uploaded documents, no matter what else you do. For more information, please see the file upload field documentation, particularly the first entry in the Notes section, which explains what i just described but probably more accurately.
You can also use the same condition in the if() to determine whether you hide the component or not. Therefore, you should both reject hiding the upload widget and display the validation message on it.
Good point - this would work, except that the plan to show a download link in place of the upload box for just-uploaded documents won't work at all (as I detailed in my last reply in the other sub-thread above).
The only thing that could work is if you somehow submitted on that action then, and returned the user back to the same form with the same grid in an activity chained loop. You'd have to maintain paging information in PV's and reload it, otherwise the user would start on the first page with default sorting. A bit of work but theoretically possible to be almost seemless. However, a bit of work, and horribly jarring for the user if anything goes wrong.
Hi Mike, I would like to access fv!files metadata from saveInto too. Is there any plan to update this component in the near future?
There are no plans that I know of for this - I believe it has not been included in 19.3, at least, though there's a chance it might be on the roadmap (nobody outside of Appian engineering would have any way of knowing one way or the other). I've been toying with the idea of creating a "Feature Request" thread on Community to call this out specifically and publicly, so watch for that and like/upvote it if you see it anytime soon.