Don't submit until all attachments have successfully uploaded

Is it possible to disable the submit button until all attachments have successfully uploaded?

Hello @SClacherty1,

You can use setInterval method to check if files are uploaded or not:

fd.rendered(function() {
    setInterval(function(){fd.control('Button0').disabled = fd.field('Attachments0').isUploading}, 1000);

good day, @mnikitina
is it a way to upload files first , and then submit the form? because on submitting the form starts uploading of files, if files are bigger it takes more time, and workflow starts first ,make some changes, and in workflow appears error on conflict of changes of modifying. So, i would like to upload firstly files, then submit the form.

Hello @ixxxl,

You can either disable the Submit button using the code sample I shared, or add form validation like so:

    name: 'MyCustomValidator',
    error: 'Wait for files to upload',
    validate: function(value) {
        if (fd.field('Attachments1').isUploading)
          return false;

        return true;

but uploading of the files is making only when i press the button submit. when i only select them it only show as a list...

like in this post

sometimes i can't use list library control. because it need to grant/remove permissions to the files in this library.

P.S strange but validator and setInterval with disabling , doesn't work for me ..


The code I shared is for public forms.

Regarding your case, this is how the attachments upload works in SharePoint. I would suggest customizing the workflow, try out the solution from this post.

oh, yes. i have sharepoint 2019.
i also make something like in url sent by you

   fd.spRendered(function () {
                function Attach() {
                    if (fd.field('Attachments').value.length > 1) {
                        fd.field('AttachFile').value = true
                        console.log('AttachFile==' + fd.field('AttachFile').value)
                    } else {
                        fd.field('AttachFile').value = false
                        console.log('AttachFile==' + fd.field('AttachFile').value)
                fd.field('Attachments').$on('change', Attach)


it's work more better, but sometime still have some conflicts. that why dedcided maybe there are other solutions.

p.S. for now i found some mistake. i just added i file, but it's show FALSE

found mistake.. it should be

  if (fd.field('Attachments').value.length > 0) {

instead of 1