function checkControls(){
//the change event function - check the status of each control
//set a variable to count the number of valid controls
var controlsPassed = 0;
//set up a selector to pick .each() of you target controls
$("input[title=Target Date],input[title=Start Date],select[title=Strategic Objective],select[title=Strategic Priority]").each(function(){
//if the control value is not zero AND is not zero-length
if($(this).val() != 0 && $(this).val().length != 0) {
//add one to the counter
controlsPassed += 1
}
});
//call the showHide function and pass the true/false statement of 4 valid controls
return (controlsPassed == 4);
}
function PreSaveItem() {
return checkControls()
}
|