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

Question

Question

Can an Upload field be hidden if used on a subsequent form and no upload files exist?

asked on July 15, 2024

Hello.

 

We are using Forms 11 Classic Form designer.
We have a form that captures optional uploaded files on the starting form.

We use that same Variable field on subsequent forms for reference purposes.  

I would like to hide any Upload field that appears on subsequent forms but does not have any uploaded content.

I cannot see how to do this with the Hide field option, so I would like to see if this can be done with Javascript.

 

Any help would be appreciated.

0 0

Replies

replied on July 18, 2024

Hi Jay, 

You can try with the code in your form, this will find all the file upload fields and check if any file is uploaded on the field, hide it if no file uploaded.

$(document).ready(function(){
	$('li[attrtype="doc"]').each(function(i, e){
    	var ele = $(e);
      	if(!ele.find('table tbody tr[class="file"]').length){
          ele.hide();
        }
    })
});

 

1 0
replied on July 15, 2024

I'm not as familiar with the Classic Designer, but with the Modern Designer, marking it as Read Only and removing the Field Title essentially hides it unless there is an upload to show, with no Javascript required.

0 0
replied on July 15, 2024

Hmm, thank you.  However, that still leave's (4) upload buttons.  I have (4) upload fields that are seldom used.  Is their javascript I could use to change it to hidden if there are no files?

That would hide it altogether.

0 0
replied on July 15, 2024

I'll play around with it, but hopefully someone smarter than me will chime in.

One thing worth mentioning though, is that Javascript only works at the form level, so they will likely still show on submission/save to repository. If that makes sense!

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

Sign in to reply to this post.