How to set attachment as required field in list form?
Original Post by KW CHAN (Imported from Ardevia Forum)
Checking it form the attachment field by using the Validation & Message behaviors but still in vain.
-
Original Post by iryna (Imported from Ardevia Forum)
There are no easy way to set an attachment field as required.
The possible solution is to add custom action to the Save button.1. Add additional action to your Save button ('Check for attachments').
It should be 'Show message' action type.2. Add the following Condition value to the action:
Code:=!jQuery('#idAttachmentsTable').is(':visible')3. Add validation message text, delay and set 'Status Color' to 'Error'.
4. Add the following Condition value to the 'Save Form' action:Code:
=jQuery('#idAttachmentsTable').is(':visible')5.Add the following Condition value to the 'Redirection' action:
Code:
=jQuery('#idAttachmentsTable').is(':visible')This solution doesn't work for the ribbon Save button. In this case it would be better to hide ribbon or at least one button. Please see related forum post Hide default edit tab - Would like the web part contents to hide the default edit tab and utilize only the rich forms tools for more information.
0 -
Original Post by KW CHAN (Imported from Ardevia Forum)
Thank you so much!
0 -
Original Post by iryna (Imported from Ardevia Forum)
In the new version the described solution works also for the Save button on the ribbon
0 -
Original Post by PJamhour (Imported from Ardevia Forum)
Originally Posted by: iryna
In the new version the described solution works also for the Save button on the ribbon
I am currently working with version 2.7.1.0 and I have not been able to get the described solution working with the save button in the ribbon, only on a form button.
0 -
Original Post by Taras Lozynskyy (Imported from Ardevia Forum)
Hi.
We cannot reproduce you issue.
If it is not critical try to reset form to defaults and try once more.0 -
Original Post by Django (Imported from Ardevia Forum)
Is there a way to get this to have an attachment conditional required??
if [FieldA]="x" then attachment=required else attachment!=required
if [FieldA]="x" OR [FieldB]="y" then attachment=required else attachment!=required
if [FieldA]="x" AND [FieldB]="y" then attachment=required else attachment!=required0 -
Original Post by Andrii Katsiubka (Imported from Ardevia Forum)
To achieve your goal you just need modify Condition:
- Open expression builder for Condition field (fx button near Condition build)
- Set expression type to "Function code" (dropdown on the top of dialog)
- Insert next code
Code
if(<YouCondition>){
return !jQuery('#idAttachmentsTable').is(':visible');
} else {
return false;
}- Replace <YouCondition> by your condition e.g:
- [[FieldA]] == "x"
- [[FieldA]] == "x" || [[FieldB]] == "y" (|| means OR)
- [[FieldA]] == "x" && [[FieldB]] == "y" (&& means AND)
- Repeat previous steps for "Save Form" and "Redirection" actions, but with the next code
Code
if(<YourCondition>){
return jQuery('#idAttachmentsTable').is(':visible');
} else {
return true;
}0
Please sign in to leave a comment.

Comments
7 comments