Validation Engine is returning false when no errors were detected and true when validation is unsuccessful, which is the opposite of what I would expect. The weird part is that the tooltips are correct. Take a look at my example.
This appears to run counter to the Validation Engine documentation. According to the Validation Engine Docs:
validate
Validates a form or field, displays error prompts accordingly.
Returns true if the form validates, false if it contains errors. For fields, it returns true on validate and false on errors. When using form validation with ajax, it returns undefined , the result is delivered asynchronously via function options.onAjaxFormComplete.
alert( $("#formID1").validationEngine('validate') );
alert( $("#emailInput").validationEngine('validate') );
HTML
<div>
<input type="text" name="billLast_Name"
class="form-control bill-field validate[required]"
placeholder="Surname*"
value=""
title="Surname"/>
<button id="validate">Validate</button>
<div id="result"></div>
</div>
jQuery
$(document).ready(function(){
$('#validate').on('click', function(){
var result = $('.bill-field').validationEngine('validate')
$('#result').html('Validation result is ' + result)
})
})
What did I do wrong?
This is apparently a known issue. The code base on GitHub includes unresolved issue #912 posted Feb. 1, 2016:
Given the way the documentation is worded, I suspect this is actually a documentation issue rather than a code issue.