Code: Select all
Der aktuelle Code, den ich habe, ist:
Code: Select all
$("input[title=Target Date],input[title=Start Date],select[title=Strategic Objective],select[title=Strategic Priority]").change(function(){
checkControls()
});
,select[title=Strategic Priority],textarea.ms-input"), aber es funktioniert nicht, Irgendwelche Ideen?
Vielen Dank im Voraus.
Bearbeiten: Der Code für die Validierung lautet:
Code: Select all
//bind a change event to all controls to validate
$("input[title=Target Date],input[title=Start Date],select[title=Strategic Objective],textarea[id$=_UserField_downlevelTextBox],select[title=Strategic
Priority]").change(function(){
checkControls()
});
//the change event function - check the status of each control
function checkControls(){
//set a variable to count the number of valid controls
var controlsPassed = 0;
//set up a selector to pick .each() of the target controls
$("input[title=Target Date],input[title=Start Date],select[title=Strategic Objective],textarea[id$=_UserField_downlevelTextBox],select[title=Strategic
Priority]").each(function(){
//if the control value is not zero AND is not zero-length
var val = $(this).val();
if($(this).is(':hidden') || (val != 0 && val.length != 0)) {
//add one to the counter
controlsPassed += 1;
}
});
//call the PreSaveItem function and pass the true/false statement of 5 valid controls
return (controlsPassed == 5);
}
function PreSaveItem() {
return checkControls()
}
edit3:
Ich habe mich verändert
Code: Select all
return (controlsPassed == 5);
Code: Select all
return (controlsPassed == 4) && ( ($("textarea[title='People Picker'][value!='']").length==1) || $("textarea[title='People Picker'][value!='']").is(":hidden") );
Code: Select all
if ($("textarea[title='People Picker'][value!='']").is(":hidden")) {
return (controlsPassed == 4)
}
else {
return (controlsPassed == 4) && ( ($("textarea[title='People Picker'][value!='']").length==1);