I am trying to do a custom js validation for a form field, I added this in my phtml file :
<script type="text/javascript">
//<![CDATA[
var theForm = new VarienForm('form-validate', true);
Validation.add('validate-testx','You failed to enter baz!',function(v){
if(v == 'baz')
{
return true;
}
return false;
});
//]]>
</script>
and added "validate-testx" to the field's css class but it did not work. I am using magento 2, please help.