diff --git a/views/bootstrap/class.AddDocument.php b/views/bootstrap/class.AddDocument.php index c5d485cb6..933c97847 100644 --- a/views/bootstrap/class.AddDocument.php +++ b/views/bootstrap/class.AddDocument.php @@ -77,9 +77,14 @@ $(document).ready(function() { }); jQuery.validator.addMethod("alternatives", function(value, element, params) { - if(value == '' && params.val() == '') - return false; - return true; + if(value != '') + return true; + var valid = false; + $.each(params, function( index, value ) { + if(params.val != '') + valid = true + }); + return valid; }, ""); $("#form1").validate({ invalidHandler: function(e, validator) { @@ -94,10 +99,10 @@ $(document).ready(function() { }, rules: { 'userfile[]': { - alternatives: $('#dropfolderfileform1') + alternatives: [$('#dropfolderfileform1'), $('#choosedocsearch')] }, dropfolderfileform1: { - alternatives: $(".btn-file input") + alternatives: [$(".btn-file input"), $('#choosedocsearch')] } }, messages: {