I am working on a validation rule that will be triggered if a checkbox is checked. If checked, either a value will need to be entered in the textbox or an attachment will need to be added.
Currently I have one rule assigned to the textbox control and another to the attachment control.
Ultimately, I want a single rule, but I have not been able to get the syntax correct. The textbox validation works as expected. However, the attachment validation will only activate after the textbox validation.
Here is the configuration.
Checkbox: MFO_Spec_Exception
Textbox: Spec_Exception_Comments
Attachment: Spec_Exception_Attach (css class attCtrlClassName7)
JavaScript:
// Spec_Except_Attach
// Spec_Except_Attach
function GetNumberOfAttachments7(attCtrlClassName7)
{
return NWF.FormFiller.Attachments.GetAttachedFilesCount(NWF.FormFiller.Functions.GetFillerDivObjectForControl(NWF$("#" + NWF$("." + attCtrlClassName7 + " .nf-attachmentsRow")t0].id)).data('controlid'))
}
and(MFO_Spec_Exception, isNullOrEmpty({Self}))
and(lessThan(GetNumberOfAttachments("attCtrlClassName7"),1), MFO_Spec_Exception)