Bart
Design Dabbler

Get display state from attachment control by CSS

Jump to solution

I am building a custom validation in Custom Javascript on a Nintex form and want to include a logical condition (if attachement control is not hidden) before checking if there are files attached using the 

GetNumberOfAttachments function.
 
Nintex JS will have to:
1. if attachement control is hidden then 'control is valid
2. if attachement control is visible and file(s) are attached 'control is valid
3. if attachement control is visible and no files(s) are attached ' control is invalid
 
The # of files uploaded is already working. Only difficulty so far, and solution I am looking for is to determine if the control is hidden or not.
Since the control has no Client ID storage I have to deal with the CSS class. But I cannot find any attribute which defines the current state of the attachement control. 
 
When trying NWF$('.nf-css-att-1-1').css('visibility') or NWF$('.nf-css-att-1-1').css('display') both will result in a visible (block) state.

 

can anyone help me making this work?

0 Kudos
Reply
3 Replies
sojanm
Workflow Veteran

Re: Get display state from attachment control by CSS

Jump to solution

what is the value that makes the attachment control hidden? check on that value and the number of attachments to validate.

0 Kudos
Reply
Bart
Design Dabbler

Re: Get display state from attachment control by CSS

Jump to solution

Hi 

 

alert(''+NWF$('.nf-css-att-5-1').css('display')+'');  result: block
alert(''+NWF$('.nf-css-att-5-2').css('display')+'');  result: none
alert(''+NWF$('.nf-css-att-5-3').css('display')+'');  result: none

if(NWF$('.nf-css-att-5-1').css('display') == 'none'){ alert('valid'); validFields.push(NWF$('.nf-css-att-1-1')); } else { if(!GetNumberOfAttachments("nf-css-att-1-1") > 0) { alert('checked invalid'); validated = false; invalidFields.push(NWF$('.nf-css-att-1-1')); } else { alert('checked valid'); validFields.push(NWF$('.nf-css-att-1-1')); }}
.... and so on for all other att-controls.

Thank you for your help and believe it or not. Your answer probably helped me identifying that.

View solution in original post

0 Kudos
Reply
sojanm
Workflow Veteran

Re: Get display state from attachment control by CSS

Jump to solution
It is all your hard work
0 Kudos
Reply