I have multiple Sharepoint dropdowns validation but I will show only two on my code. I can't seem to find where the problem is. The logic is if the user choose from any dropdown values <> "yes" then user must fill-out the respective exception multiline textbox.
The first If Else statement is working but the second is not. I appreciate any help.
<script>
function PreSaveAction()
{
return formVal(); //calls the validation on save
}
function formVal() {
if ($("[title='Acknowledgement']").val() == 'Yes') {
return true;
}
else {
if ($("[title='Acknowledgement Exception']").val().length) //checks if not empty use length > X to stipulate min char length allowed
{
return true;
}
else { //textbox is empty
alert('Error: Please add the required exception into the box before submitting');
}
}
return false;
if ($("[title='Preparation Review']").val() == 'Yes') {
return true;
}
else {
if ($("[title='Preparation Exception']").val().length) //checks if not empty use length > X to stipulate min char length allowed
{
return true;
}
else { //textbox is empty
alert('Error: Please add the required preparation exception into the box before submitting');
}
}
return false;
}
</script>