Forum Discussion
ArchiveUser
13 years agoQrew Captain
Hi - while there is no native feature for this, there is a fairly straight forward, simple and creative solution.
1) Setup a Formula-Text field. Something like this formula would work fine:
var text file = ToText([Attachment]); //convert the name of the file attachment to textvar text extension = Right($file,"."); //parse apart the file attachment text so we get the extension (all characters after the last period)$extension //show the extension
* Replace [Attachment] with the name of your field.
* I use variables here just because I find them cleaner to illustrate the logic. Certainly one long text string would work fine.
2) Setup a Formula-Checkbox field which will contain the logic for your file extensions:
If( Contains([Description],"PDF") or Contains([Description],"PNG"), true, false)
3) Set a form rule to prevent the save when this box = false.
A few notes:
* You could do this all in one field quite easily. I just like this approach because it is kind of like "showing your work" and allows you to quickly debug if necessary.
* The reverse could easily be done to only prevent the save when the box is checked, if you wanted to explicitly deny some document types as opposed to this approach which only allows two choices.
Let me know if you need any help!
1) Setup a Formula-Text field. Something like this formula would work fine:
var text file = ToText([Attachment]); //convert the name of the file attachment to textvar text extension = Right($file,"."); //parse apart the file attachment text so we get the extension (all characters after the last period)$extension //show the extension
* Replace [Attachment] with the name of your field.
* I use variables here just because I find them cleaner to illustrate the logic. Certainly one long text string would work fine.
2) Setup a Formula-Checkbox field which will contain the logic for your file extensions:
If( Contains([Description],"PDF") or Contains([Description],"PNG"), true, false)
3) Set a form rule to prevent the save when this box = false.
A few notes:
* You could do this all in one field quite easily. I just like this approach because it is kind of like "showing your work" and allows you to quickly debug if necessary.
* The reverse could easily be done to only prevent the save when the box is checked, if you wanted to explicitly deny some document types as opposed to this approach which only allows two choices.
Let me know if you need any help!