furstlars
Workflow Hero

Re: attachments custom validation

Jump to solution

@emha 

 

Is it possible to set a calculated value (connected to a column) to "Yes" if the count is > 0?  I've tried various methods but it won't display, such as

 

function GetNumberOfAttachments(attCtrlClassName) {

return NWF.FormFiller.Attachments.GetAttachedFilesCount(NWF.FormFiller.Functions.GetFillerDivObjectForControl(NWF$("#"+NWF$("." + attCtrlClassName + " .nf-attachmentsRow")[0].id)).data('controlid'))

if (GetNumberOfAttachments("nf-form-input") > 0) {
NWF$('#' + AttachmentBoolean).val("Yes");
NWF$('#' + AttachmentBoolean).trigger('focusout');
}

 

0 Kudos
Reply
emha
Automation Master
Automation Master

Re: attachments custom validation

Jump to solution

pure technically, yes it's possible.

 

 

but the problem is how to fire calculated value control recalculation based on attachement changes....

one would need to make the formula dependent on attachement control. but attachement control is not listed among named controls, so you cannot reference it directly.

furthermore, due to it's complexity, attachement control do not fire any 'change' event that you could write custom handler for.

 

so one would need to make some custom/manual trigger to force recalculation. eg. textbox change, yes/no checkbox state change, etc.

if that' suitable for you, then I think it could work.

 

0 Kudos
Reply
MAC
Forms Fledgling

Re: attachments custom validation

Jump to solution

Hi all,

I have a form (Nintex Forms 2010 - 1.12.2.20) that has 8 attachment fields, each of them, depending on the stage of completion, must contain a file. I used the solution available on this site and put in setting the code:

function GetNumberOfAttachments()

{

return NWF.FormFiller.Attachments.GetAttachedFilesCount(NWF.FormFiller.Functions.GetFillerDivObjectForControl(NWF$("#"+NWF$("." + "AttachmentControlClass" + " .nf-attachmentsRow")[0].id)).data('controlid'))

}

NWF$( document ).ready(function($){

//alert(1);

}); 

 

Then in each of the attachment fields, I put in CSS Class: AttachmentControlClass1, ..... AttachmentControlClass8

 

For each of the attachment fields I made one rule:

(T1!=0)&&(GetNumberOfAttachments("AttachmentControlClass1")<1) ......

(T8!=0)&&(GetNumberOfAttachments("AttachmentControlClass8")<1)

Where T are fields Yes No

 

When I mark the T fields and submit, there are criticism in all attachment fields, but if I put one attachment in the first attachment field and submit, there is no more criticism in the other fields.

Please let me know if I am making a mistake or if is not possible validate multiple attachment fields,

 

Regards

0 Kudos
Reply