- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2024 03:18 AM
Hi All,
I have a field called Attachment, In that I have 3 choices i.e Test1 Test2 and Test3
if I select Test1 and Test2,
Error message should display attachemt is manadatory
if I select Test3
it should not give any error
Note: Only for Test1 and Test2 only we have the attachment not for entire form.
could you please help on this
Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2024 06:28 AM
@Community Alums Thanks for marking my answer as helpful. If it helped you in any way please accept the solution so that it will be beneficial to the future readers with the same query.
Regards,
Swathi Sarang
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2024 03:58 AM
Hi @Community Alums ,
var checkVal = g_form.getValue(''u_attachement); // your field here
if(checkVal == 'Test1' || checkVal == 'Test2' ){ // check if the value is test1 or test 2
if (this.document.getElementsByClassName('get-attachment').length == 0) {
g_form.addErrorMessage(getMessage('attachment_mandatory'));
}
}
☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2024 04:19 AM
Hi @Community Alums ,
You can create on submit catalog client script,
function onSubmit() {
if((g_form.getValue('attachment') == 'test1' ||(g_form.getValue('attachment') == 'test2')) && this.document.getElementsByClassName('get-attachment').length == 0) {
g_form.addErrorMessage(getMessage('Attachment is mandatory'));
alert('Attachment is mandatory');
return false;
}
}
Please mark this comment as Correct Answer/Helpful if it helped you.
Regards,
Swathi Sarang
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2024 06:28 AM
@Community Alums Thanks for marking my answer as helpful. If it helped you in any way please accept the solution so that it will be beneficial to the future readers with the same query.
Regards,
Swathi Sarang