I currently have a PreSaveAction function that I was given. It currently looks at the people picker field (Reviewer 2) to make sure it is filled before allowing the form to be saved. Is there a way to change it to look at the choice field (Rev2 Required) instead? Here's my script:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script type="text/javascript">
function PreSaveAction(){
//these look for the display name values in the associated people pickers
var rev2 = $("input[Title='Reviewer 2']").attr("aria-label");
if(rev2){
return true;
}
else{
alert("You must select a person as Reviewer 2. Please refer to the Approval and Payment of Invoices policy for guidelines.");
return false;
}
}
</script>
<script type="text/javascript"> function PreSaveAction(){ //these look for the display name values in the choice field var choiceFieldValue = $("select[title$='ChoiceFieldName']").val(); if(choiceFieldValue){ return true; } else{ alert("Does this invoice require a second reviewer? If so, please refer to the Approval and Payment of Invoices policy for guidelines."); return false; } } </script>