Hello, I have a form that has 2 attachments on it, the first was easy to configure that validation as it is mandatory for 1 attachment. The second attachment which is my default is only needed if user select Yes on a Radio Choice. I am having issues with code as I am new to javascript.
I have been following this post but cannot get it to work;
Attachment Validation based on checkbox in a Multiple attachment form
Here is my choice control settings;
Here is the code that I have attempted with no luck;
function fnAttachmentValidation(source, arguments)
{
var Control = NWF$("#" + BankAttachmentID);
var elm = NWF$("table[id*=idAttachmentsTable]");
var elmAttachmentRow = NWF$("div[id*=idAttachmentsRow]");
if(Control.is(':checked') == true)
{ // minimum one attachment is required
if ((elm != null && elm.prop('rows').length > 0) && (elmAttachmentRow != null))
{
arguments.IsValid = true;
}
else
{
arguments.IsValid = false;
if(NWF$('.nf-validation-summary').css('display') !='non'){
WF$('.nf-attachment-control').css("border", "red solid 2px");
}
}
}
Can someone help me with the code, this is a mandatory requirement if user selects 'Yes' on the control, I cannot use the standard validation as if 'No' is selected I have a separate workflow that gets started.
Thank you,
Hi Tim
first thing to do is syntax checking! There are syntax errors in coding, e.g.
Kind regards
Manfred
apart from issues Manfred pointed out, if you carefully read the thread you linked, you would see the solution provided there is not correctly in all circumstances.
I would rather advised to get inspired by following threads