Anyone ever written a script to restrict the forma...
# suitescript
b
Anyone ever written a script to restrict the format type of a file being uploaded to a file field? I need to restrict formats to PDF types and its giving me quite the headache 😡
n
are you creating the field in Suitelet or on a form, If on the form, you might wanna have a look at the field Validation & Sourcing subtab and see how to go from there, otherwise you can script it. Should not be that difficult. Just use the client script and check the File.type if matches the types you want to insert and return false if that is not true. Or else, you can use a inline html field and do this using jQuery
b
Hi @Nik The field is on a form and the script is a ClientScript. Problem is the Validation & Defaulting subtab doesn't cater for that feature and the N/File module isn't accessible on clientScripts. Let me try the inlinehtml field option. Thanks for the suggestion. Will post the solution once I solve this problem