Skip to main content

Hi All,

 

we have a requirement that, we have to restrict the attachment type for an file attachment control in smart form.

 

In detail: We need to allow the user to attach only .xls(Excel) files. If they are trying to attach some other type of files it has to throw the error message.

 

Can you please give an idea how we can restrict the user for adding other type of files.

 

Regards

Srinivas Kondapalli

  

Dear  @Amar,


 


 


 


12442i172815FEA0092870.png


 notice that I added two data labels one I gave it ID "AttachmentDetails" and the other one I gave it ID "IsValid" and the text is 0


 


now we need to add a rule:


 


11604i2887BEEA8BB0DC25.png


 


 


Rule Config


 


15524iB099649CC60DA78C.png


 


 


First line is to transfare 0 to the IsValid Data lable and the attachment control to the AttachmentDetails Data lable:


 


13037i0557DF7F3A51E27E.png


 


now when we transfare the attachment control to data lable we can see its details 


 


Second Line:


I added rule to check if my AttachmentDetails Data Lable  contains ".xlsx" and to check that is not empty Plus to check that my attachment control is not empty either


11591i3975C08CAB2EBC39.png


 


Third Line: Just to show msg if the attacment file is Excel


 


Fourth Line: transfares 1 to "IsValid"  Data Lable, this is just to ignore the second if condition as long as we've added a valid file.


11627iDA5A2D236F047B5E.png


 


Fifth Line: here we check if the file is not valid and the attachment control is not empty15946i03E3DACEC99338DD.png


 


Sixth Line: to show warning Msg


 


Seventh Line: we just check the attachment control to empty it as long as the file is not valid 


13355iD97C7ED1B865909F.png


 


 


Test:


 


how the view looks before action:


16218iCBBA5B089A4A562A.png


 


 


I added a word document:


14393i1922F1811CD02779.png


 


Added Valid faile:


15341i15718E73ADB88B4B.png


 


wish it helps :)


 


Regards,


 


Hi Steve,

 

Thank you very much!!!

 

Regards

Srinivas Kondapalli


Reply