I need to make a field required on the edit form. It does not appear on the New Form. I can't set it as required at the site column level because the system will not save the New form without that field completed.
I took this PreSaveAction
script from another form I have used it with and tried to modify to fix my issue. I installed it as a script editor web part
and when I went to the edit page, it triggers the alert, but won't save when I actually fill in the field.
<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 text field
var textDept1 = $("select[title$='Dept#1']").val();
if(textDept1){
return true;
}
else{
alert("Please insert a Department Number and EOC Code to continue.");
return false;
}
}
</script>