cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
ehantzis
Nintex Newbie

Hi, I am trying to create a form where the minimum attachment is based on the amount of rows in a repeating table where a field is equal to true

within a repeating section I have a field titled evidence which is a yes or no choice. I am trying to come up with a solution where if there is 5 rows in a repeating section and 2 of those rows have the evidence field set to yes then the minimum attachments should be 2.

I assume I might need to use JavaScript.

Labels: (1)
Reply
8 Replies
Automation Master
Automation Master

Re: Hi, I am trying to create a form where the minimum attachment is based on the amount of rows in a repeating table where a field is equal to true

Hi!

By merging together cool answer from  Marian Hatala‌: attachments custom validation, together with OOB Nintex features, you can achieve it that way:

  1. Set name to the "checkbox" field in your repeating section, ex. "EvidenceNeeded"
  2. Put the following javascript validation method into the "Custom JavaScript" section of your form's settings:
    function GetNumberOfAttachments(attCtrlClassName){
       return NWF.FormFiller.Attachments.GetAttachedFilesCount(NWF.FormFiller.Functions.GetFillerDivObjectForControl(NWF$("#"+NWF$("." + attCtrlClassName + " .nf-attachmentsRow")[0].id)).data('controlid'))
    }
  3. Set a class name for your attachments field:
    1. Open "properties"
    2. Scroll to "Formatting" group
    3. Add your custom class (you don't need to replace the existing ones) to the "CSS class" attribute, ex.: "AttachedEvidences"
  4. Set a validation rule to your "Attachment" field:
    GetNumberOfAttachments("AttachedEvidences") != sum(EvidenceNeeded)
    Where
    1. "AttachedEvidences" is that class name from step no. 3
    2. EvidenceNeeded is the named control (it has to be named control!) that you set in step no. 1
  5. Save, run/ preview and you will notice, that your form is properly validated.

Regards,

Tomasz

Reply
radityo_ardi
Nintex Newbie

Re: Hi, I am trying to create a form where the minimum attachment is based on the amount of rows in a repeating table where a field is equal to true

Tomasz Poszytek‌, got any solution for responsive forms?

0 Kudos
Reply
Automation Master
Automation Master

Re: Hi, I am trying to create a form where the minimum attachment is based on the amount of rows in a repeating table where a field is equal to true

Nope, I don't. I suggest you to play around with rules. Maybe it would work if you use expressions to count rows and attachments, then to compare both outcomes. But I don't know if that is feasible.

Best regards,

Tomasz Poszytek

e-mail: tomasz@poszytek.eu

tel: +48 603 993 372

www/ blog: https://poszytek.eu

twitter: @TomaszPoszytek

0 Kudos
Reply
Automation Master
Automation Master

Re: Hi, I am trying to create a form where the minimum attachment is based on the amount of rows in a repeating table where a field is equal to true

Elias Hantzis has my solution worked for you? If so, please mark my answer as correct. Thanks!

Regards, Tomasz 

0 Kudos
Reply
ehantzis
Nintex Newbie

Re: Hi, I am trying to create a form where the minimum attachment is based on the amount of rows in a repeating table where a field is equal to true

Hi Tomasz,

I haven’t had time to implement this solution. My apologies.

Regards,

Elias Hantzis

ICT Administrator

Country Regional Network

Level 1, 20 Smith St, Parramatta NSW 2150

P. 02 9685 5102 | M. 0429 316 344

E. elias.hantzis@jhg.com.au<mailto:elias.hantzis@jhg.com.au> | W. www.jhrcrn.com.au<https://urldefense.proofpoint.com/v2/url?u=http-3A__www.jhrcrn.com.au_&d=DwMFAg&c=lf6PGhmJKTmtyLqIXF-b3g&r=oi-x6Eop3DYWSyK3Jf-DWEBgAuveIetvY3OetEzQWds&m=iulocyipyzo_ZFuzm6Y5X2-1n4dMex3ucEShrZ0eegg&s=OL14ujiwqUNA-ejEfAZjSMPA_PuC5pH8g1eI_daROL4&e=>

0 Kudos
Reply
Automation Master
Automation Master

Re: Hi, I am trying to create a form where the minimum attachment is based on the amount of rows in a repeating table where a field is equal to true

No problem. Find your time and post a feedback

The described solution was tested by me and was working fine. 

Regards,

Tomasz

0 Kudos
Reply
shirimolot
Nintex Newbie

Re: Hi, I am trying to create a form where the minimum attachment is based on the amount of rows in a repeating table where a field is equal to true

Hi Tomasz Poszytek‌,

I tried your solution on the responsive form and it's not working. It seems there is no validation at all in this control (even with simple validation rule).

Did you find other solution to this issue? 

Regards,

Shiri

0 Kudos
Reply
Automation Master
Automation Master

Re: Hi, I am trying to create a form where the minimum attachment is based on the amount of rows in a repeating table where a field is equal to true

Hi,

that solution was indeed for Standard forms, not RWD. If there are no rules to count number of attachments in RWD forms, then there is no way to achieve it. If you need such functionality maybe consider switching back to Standard form?

Regards,

Tomasz

0 Kudos
Reply