FileUpload Validation

Certified Senior Developer

I am implementing a gridRowLayout. Inside the gridRowLayout I am implementing a fileUpload field. 

So that I can add a new row dynamically and for each row I can upload 1 document.

But the demand here is ... I cant upload same files again and again (i.e. I cant upload same files in different rows) . But I am not quite sure how to do the validation for it. Can anyone help me with this ? 

This validation I have added for fileName. But as you see I could upload same files. I need validation to say that File Already Uploaded. Is there a way to do this validation ?

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Senior Developer

    Hi,

    Can you share your code snippet?

  • 0
    Certified Senior Developer
    in reply to Shikha

    a!localVariables(
    local!uploadedDocuments: index(ri!data, "uploadedFiles", null),
    a!gridLayout(
    label: "UPLOAD FILES",
    headerCells: {
    ..
    },
    columnConfigs: {
    ..
    },
    rows: {
    a!forEach(
    items: local!uploadedDocuments,
    expression: {
    a!gridRowLayout(
    contents: {
    a!fileUploadField(
    target: cons!TargetFolder,
    label: "Attach Documents",
    labelPosition: "ABOVE",
    maxSelections: 1,
    value: ..,
    saveInto: {..},
    ),
    a!richTextDisplayField(
    value: a!richTextIcon(
    icon: "times",
    link: a!dynamicLink(
    saveInto: {..}
    ),
    linkStyle: "STANDALONE",
    color: "NEGATIVE"
    ),
    showWhen: not(ri!readOnly)
    )
    }
    )
    }
    )
    },
    addRowLink: a!dynamicLink(
    label: "Attach New Document ",
    saveInto: {..},
    showWhen: not(ri!readOnly)
    )
    ),
    )

Reply
  • 0
    Certified Senior Developer
    in reply to Shikha

    a!localVariables(
    local!uploadedDocuments: index(ri!data, "uploadedFiles", null),
    a!gridLayout(
    label: "UPLOAD FILES",
    headerCells: {
    ..
    },
    columnConfigs: {
    ..
    },
    rows: {
    a!forEach(
    items: local!uploadedDocuments,
    expression: {
    a!gridRowLayout(
    contents: {
    a!fileUploadField(
    target: cons!TargetFolder,
    label: "Attach Documents",
    labelPosition: "ABOVE",
    maxSelections: 1,
    value: ..,
    saveInto: {..},
    ),
    a!richTextDisplayField(
    value: a!richTextIcon(
    icon: "times",
    link: a!dynamicLink(
    saveInto: {..}
    ),
    linkStyle: "STANDALONE",
    color: "NEGATIVE"
    ),
    showWhen: not(ri!readOnly)
    )
    }
    )
    }
    )
    },
    addRowLink: a!dynamicLink(
    label: "Attach New Document ",
    saveInto: {..},
    showWhen: not(ri!readOnly)
    )
    ),
    )

Children