You are viewing limited content. For full access, please sign in.

Question

Question

File Upload Table Structure Differs in Preview Mode

asked on January 16, 2020

Can someone explain why the table structure of a file upload button is different in Preview Mode than it is when you actually start the process?

 

We discovered this when trying to count tr elements in the file upload table to get the file count. We developed the solution in preview that required us to divide the number of rows by 2 and subtract 1 to get the actual number of files, but when we moved to actually running the process the count was no longer correct. The table structure was significantly different.

 

Can someone explain why?

0 0

Replies

replied on January 17, 2020 Show version history

Hello,

 

I don't know what is the exact code that you are using to get the number of rows, but you can get the number of rows by using the following line :

$('.tableClass .propCount').attr('value');

it is the same in preview and submission.

hope it helped.

 

Maher,

 

 

 

1 0
replied on May 6, 2020

I am not seeing this hidden property on the FileUpload table like I do on traditional tables.

0 0
replied on January 17, 2020

The code we were using when we came to this conclusion is here:

$('.MyTable').on('change blur', function() {
        var rows = $('.MyTable tr').length;
        var files = (rows / 2) - 1;
        var elements = $('.MyTable .file-del').length;
        console.log('Rows ='+ rows);
        console.log('Files ='+ files);
        console.log('Elements ='+ elements);
        $('#q79 input').val(elements);
        $('#q23 input').prop('required', true);
    });

 

Now that I fiddle with it some more, it appears that it is more about the timing of the calculations. In preview, I'm seeing the file upload almost instantly. So the calculations happen after the table has added the row for the file. When we run the process, the files actually upload therefore taking longer for the table to update and the calculations are premature and finish without the new file included.

 

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.