File upload validation

I'm using the following code to validate a user uploaded file : 

 

a!gridRowLayout(
id: ri!index,
contents: {
if(
ri!index > ri!oldAttachments,
a!fileUploadField_17r1(
label: "file upload " & ri!index,
target: ri!target,
value: ri!attachments[ri!index],
saveInto: ri!attachments[ri!index],
validations:{
if(
or(
find("JPG", a!fileUploadField(value: ri!attachments)),
find("JPEG", a!fileUploadField(value: ri!attachments)),
find("PNG", a!fileUploadField(value: ri!attachments)),
find("ICO", a!fileUploadField(value: ri!attachments)),
find("GIF", a!fileUploadField(value: ri!attachments)),
find("BMP", a!fileUploadField(value: ri!attachments))
)>0,"Invalid Format",{}

) } 

 

... 

 

but it gives an error in a!for Each() while uploading another file 

  Discussion posts and replies are publicly visible

Parents Reply
  • Thank you..
    Currently, there is no error message as I have used "a!fileUploadField" instead of "a!fileUploadField_17r1" and the validations are valid , but now each "upload file" segment occupies two rows in the attachments grid on the dashboard and both the occupied rows both contain the "+" sign to add files, but when I try to add files in the 2nd row after adding in the 1st row, they are not uploaded in the 2nd row. Apologies, Its a little difficult to explain
Children
No Data