0

i want to set validation using multiple fields in Newitem.aspx. e.g. if user select type "Sick leave" and number of days are > 3 then he must add "attachment". i tried with presave action but it's only supporting for attachment validation whereas i want to add two more conditions.

can anyone guide me in this regard?

1 Answer 1

0

I do it in PreSaveAction as well. Something like this? just set your 2 other variables you care about, using javascript or jquery.

    <script type="text/javascript" language="javascript">
function PreSaveAction() {
           var type = $('input[Title="Field Name"]').val();
           var numberDays = ......
           var elm = document.getElementById("idAttachmentsTable");

if (type == 'Sick leave' && numberDays > 3 && (elm == null || elm.rows.length == 0))
{
               document.getElementById("idAttachmentsRow").style.display='none';

alert("Please attach Documents");
return false ;
}
else { return true ;}
}
</script>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.