Attachments Field Is Empty

Hello,

I am looking to force people to add an attachment to the form. It doesn't look like I can make the attachments field a required field, so is there a way for me to hide the submit button based on the attachments being empty?

I have been able to hide buttons based on text fields, but have not figured out the syntax for checking to see if the Attachments field is empty or not.

Thanks in advance for your help.

Hello @wbrunner,

You can add a custom validator to the form. So when a user submits the form and no files attached, he will receive an error message.

Please see the code sample below.

fd.spRendered(function(){

fd.field('Attachments').validators.push({
        name: 'Attachments Validation',
        error: "Please add attachment",
        validate: function() {
            if (fd.field('Attachments').value.length == 0) {
                    return false;
                }
            return true;
    }
})

});