Prevent Removal of Uploaded Document

Hello, I have a use case in which I need to allow a user to upload multiple documents to a SAIL form via a!fileUploadField. Once the desired docs are uploaded, the user clicks a button to commit the documents to the form and sets a Boolean variable that's used to disable the file upload field. I need to prevent the user from adding more documents AND prevent them from removing committed docs once the button is clicked.

I have accomplished the ability to disable the file upload field, preventing additional uploads however the user can still remove uploaded documents from the interface via the X next to the document name. Is there a way to disable all functionality on a file upload field, including the ability to remove docs?

Thanks in advance for your help!

OriginalPostID-247982



  Discussion posts and replies are publicly visible

Parents
  • @jerimiah - As far as I understand from the requirements, A User will upload as many documents and once he clicks on "File Upload Complete", the user should not be able to remove the documents uploaded previously. To achieve the above requirement, there are 2 ways of doing it.

    1.\tMake the "File Upload Complete" button as buttonWidgetSubmit and submit the form and reload. While reloading, (consider ri!uploadedFiles is the list of file uploads), append all values in ri!files to ri!uploadedFiles and check if ri!uploadedFiles is not-empty. If true, then display all the filenames in a textField(with size) with no labels, iterated through a!applyComponents. By this way, the End User will not see the remove link. If you follow the same procedure of creating a Multi-file upload component as mentioned in,

    https://forum.appian.com/suite/help/7.11/SAIL_Recipes.html#Add_Multiple_File_Upload_Components_Dynamically

    Then, update the rule!ucMultiFileUploadRenderField() with:

    =with(
    local!paddedArray: append(ri!files, null),
    {
    if(not(rule!APN_isEmpty(ri!uploadedFiles)),
    a!textField(
    labelPosition: "ADJACENT",
    readOnly: true,
    value: concat(document(ri!uploadedFiles,"name"),".",document(ri!uploadedFiles,"extension"),"(",document(ri!uploadedFiles,"size"),"KB)")
    ),
    a!fileUploadField(
    label: if(ri!index = 1, ri!label, ""),
    target: ri!target,
    value: local!paddedArray[ri!index],
    saveInto: {
    a!save(ri!files, ucMultiFileUploadResizeArray(ri!files, ri!index, save!value))
    }
    ))
    }
    )
    2. You can follow same methodology, and replace the a!textField with a!documentDownloadLink.

    Please lemme know if this suffice!
Reply
  • @jerimiah - As far as I understand from the requirements, A User will upload as many documents and once he clicks on "File Upload Complete", the user should not be able to remove the documents uploaded previously. To achieve the above requirement, there are 2 ways of doing it.

    1.\tMake the "File Upload Complete" button as buttonWidgetSubmit and submit the form and reload. While reloading, (consider ri!uploadedFiles is the list of file uploads), append all values in ri!files to ri!uploadedFiles and check if ri!uploadedFiles is not-empty. If true, then display all the filenames in a textField(with size) with no labels, iterated through a!applyComponents. By this way, the End User will not see the remove link. If you follow the same procedure of creating a Multi-file upload component as mentioned in,

    https://forum.appian.com/suite/help/7.11/SAIL_Recipes.html#Add_Multiple_File_Upload_Components_Dynamically

    Then, update the rule!ucMultiFileUploadRenderField() with:

    =with(
    local!paddedArray: append(ri!files, null),
    {
    if(not(rule!APN_isEmpty(ri!uploadedFiles)),
    a!textField(
    labelPosition: "ADJACENT",
    readOnly: true,
    value: concat(document(ri!uploadedFiles,"name"),".",document(ri!uploadedFiles,"extension"),"(",document(ri!uploadedFiles,"size"),"KB)")
    ),
    a!fileUploadField(
    label: if(ri!index = 1, ri!label, ""),
    target: ri!target,
    value: local!paddedArray[ri!index],
    saveInto: {
    a!save(ri!files, ucMultiFileUploadResizeArray(ri!files, ri!index, save!value))
    }
    ))
    }
    )
    2. You can follow same methodology, and replace the a!textField with a!documentDownloadLink.

    Please lemme know if this suffice!
Children
No Data