Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

Require attachment when a certain radio button value is checked

$
0
0

I have searched for sources about attachment validations and I found this source:

<scripttype="text/javascript"src="https://code.jquery.com/jquery-1.11.1.min.js"></script><scripttype="text/javascript">functionPreSaveAction(){//replace the CheckBox with your column A's actual nameif($("input[title='CheckBox']")[0].checked&&$("#idAttachmentsRow").css("display")=="none"){
	alert('If you select "Yes" in Column A, you must attach one file to the item at list!');returnfalse;}returntrue;}</script>

In this case, the attachment is required only then, when CheckBox is checked. In my case I have a choice column "File attached" with radio buttons with values "Yes" and "No" and the attachment must be required only then, when radio button with a value "Yes" is checked.

How should I modify the code above? I imagine something like: if (<"File attached" column name> is equal to "Yes" AND....). I have tried:

var strText="Yes";

if($("input[value$='File attached']").contains("' + strText + '")&&....)

But it is not working, how should I do it right?


Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>