Search code examples
javascriptjqueryjquery-validation-engine

jQuery validation engine logical OR


Using jquery validationEngine, I would like to validate a field as empty OR a valid date.

Does validationEngine support logical OR or would this require a custom method?

The following code would require a date.

<input type="text" id="someName" name="someName" 
    value="{$someValue}"  class="validate[required],custom[date]"/>

I need the correct logic inline for "empty/null OR custom[date]"


Solution

  • class="validate[false,custom[date]]"
    

    I don't know whether its a hack or valid to pass arg as false, I checked the API I didn't see any thing like that.

    if the input tag contains value it will validate with date, otherwise it doesn't do anything.

    http://jsfiddle.net/cx0rrea9/1/