Hi Kurt.
Use below code to show attachment as required and set it to not required on field change.
--------------------------
var theBinding = 'my:Attachment_1';
var attachments= $j('span[binding="' + theBinding + '"]');
var attSpan = $j(attachments[0]);
if ($form.getValue('/my:myFields/my:field_4') == 'X') {
SVFormInternalAttachmentValidations['my:Attachment_1'].minimum = 1;
$j(attSpan).find('input[type=file]').addClass("frm_required_error");
Utils.addMessageToControl($j(attSpan));
}
else
{
SVFormInternalAttachmentValidations['my:Attachment_1'].minimum = 0;
$j(attSpan).parents('div:first').find(".text-danger").remove();
if ($j(attSpan).find('input[type=file]').hasClass("frm_required_error")) {
$j(attSpan).find('input[type=file]').removeClass("frm_required_error");
}
}
--------------------------------
Hope this helps.
Regards
------------------------------
Hammad Naeem
*Precisely Software Inc.
------------------------------
Original Message:
Sent: 02-27-2026 17:35
From: Hammad Naeem
Subject: Evolve Attachment Element properties
Hi Kurt,
you can modify the javascript code as below:
-----------------------------------------
if ($form.getValue('/my:myFields/my:field_4') == 'X') {
SVFormInternalAttachmentValidations['my:Attachment_1'].minimum = 1
}
else
{
var theBinding = 'my:Attachment_1';
SVFormInternalAttachmentValidations['my:Attachment_1'].minimum = 0;
var attachments= $j('span[binding="' + theBinding + '"]');
var attSpan = $j(attachments[0]);
$j(attSpan).parents('div:first').find(".text-danger").remove();
if ($j(attSpan).find('input[type=file]').hasClass("frm_required_error")) {
$j(attSpan).find('input[type=file]').removeClass("frm_required_error");
}
}
----------------------------------------
NOTE: in else statement i have defined binding for attachment as: var theBinding = 'my:Attachment_1'; you can update this accordingly, rest of the code stays same.
Hope this helps.
Regards
------------------------------
Hammad Naeem
*Precisely Software Inc.
------------------------------
Original Message:
Sent: 02-27-2026 16:52
From: Kurt Marshman
Subject: Evolve Attachment Element properties
Hammad,
Is there a method to removed the red "Required" error message under the Attachment Control when you remove the X in Field_4?
Example - When I place an X in Field_4 I can set minimum=1, maximum=1 and message="" in the Attachment
If I try to submit I get the "Required"... which I should.
However, if I remove the X in Field_4 and set set minimum=0, maximum=1 and message="" which works but the "Required" message still appears, but allows me to submit the form.
------------------------------
Kurt Marshman
Self-Registration Shared Account
Original Message:
Sent: 02-03-2026 04:57
From: Hammad Naeem
Subject: Evolve Attachment Element properties
Hi Renette,
Solution is available on below link, when you enter X in Field_4 it will set Attachment control mandatory and require atleast one attachment, else it will set it to 0, refer rule applied on Field_4.
https://nowtransfer.de/21826f8fa5ff
hope this helps.
Regards
------------------------------
Hammad Naeem
*Precisely Software Inc.