I'm trying to figure out how to require EITHER an attachment or a website. It is to assist in registration for the training requested in the form.
So if they don’t have an attachment but have a website this would satisfy the requirement. Or if they have an attachment, the website would no longer be required.
I’ve figured out how to make the attachment required, but how do I over ride the requirement if the user includes a website instead (or visa versa)?
I’ve tried counting the attachment using a calculated field, but it doesn’t refresh when an attachment is included.
Thanks,
Vickie
Solved! Go to Solution.
Have a look at this, you should be able to work a solution from here?
http://www.vadimtabakman.com/nintex-forms-attachment-required.aspx
function AttachmentValidation(source, arguments)
{
var Control = NWF$("#" + webSite).val();
var elm = NWF$("table[id*=idAttachmentsTable]");
var elmAttachmentRow = NWF$("div[id*=idAttachmentsRow]");
if(Control == "")
{ // minimum one attachment is required
if ((elm != null && elm.prop('rows').length > 0) && (elmAttachmentRow != null))
{
arguments.IsValid = true;
}
else
{
arguments.IsValid = false;
}
}
}
Follow the post above and set your website client ID javascript variable name to webSite
Disclaimer: I'm VERY new to JavaScript! All script I've used is copied.
I appreciate your taking the time to help me.
I added your script to the form's Custom JavaScript area (under settings). I then double clicked on the Website control and set the "Store client ID in JavaScript variable" to Yes, entered webSite as the Client ID JavaScript variable name. Published my form.
Nothing different seems to be happening. I can still submit my form without an attachment or website.
I have no idea how to troubleshoot the issue.
Thanks again,
Vickie
Vicki,
On you web site control go to validation and change the validation setting to custom validation. Then paste this in the validation:
AttachmentValidation
Then it will call you function when the form is saved and check to see if it is valid or not.
Thank you, works like a charm!!