It appears that the ValidationEngine plugin allows you to specify a validation rule which uses a custom function to determine validity.
If you add the validate class on input1
like so...
<input id="input1" class="validate[required,funcCall[myValidationFunction]]" />
Then ValidationEngine will use the following function. You can pretty much put any kind of logic in there. If I read your scenario correctly, this should accomplish what you're after.
function myValidationFunction() {
var input1 = $.trim($("#input1").val());
var input2 = $.trim($("#input2").val());
var input3 = $.trim($("#input3").val());
if (input1.length == 0) {
return "input1 is required";
}
if (input2.length == 0 && input3.length == 0) {
return "Either input2 or input3 is required";
}
// We don't need to return anything if there is no error.
}
Here's a link to the _funcCall
function in the source code:
https://github.com/posabsolute/jQuery-Validation-Engine/blob/master/js/jquery.validationEngine.js#L574