Do Not Save If there is an error

Hi,

I have the script below, where it triggers an error message if there is not attachment.

fd.spRendered(function(){

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

});

I just got an issue now that even if there is an error message. The input to the fields got saved on my sharepoint fields got saved in my sharepoint list. How do disable this? What I want to happen is that the user cannot save anything on my sharepoint list if there is an error message.

Thanks.
Jamail

Hello @Jamail_Serio,

This code doesn't allow users to submit items if there are no attachments. The field values are not saved too.

Is that the complete code that you have on the form? Do you get any error messages in the console(F12)?