[eluser]ardinotow[/eluser]
[quote author="ianolito" date="1203898898"]I just experienced the same problem. One my fields is not required but I still want to validate it through a custom callback function.
Quote:Validation is not carried out on an empty input unless the “required” switch is used.
Is this a bug that should be reported? Or is this supposed to be normal behavior? I'd like to have someone's input on this.[/quote]
I also have same problem. Callback function will not work on empty field so here is my trick:
1. Set the default value of your field that need to validate to '-' (without qoute)
2. Add this javascript to make sure that '-' will still the default value eventhough a user delete '-':
onFocus="if (this.value=='-'){this.value='';};return false;" onBlur="if (this.value==''){this.value='-';return false;}"
--> copy-paste the javascript to text or textarea identifier. Example:
<textarea name="address" cols="40" rows="4" id="address"
onFocus="if (this.value=='-'){this.value='';};return false;" onBlur="if (this.value==''){this.value='-';return false;}">
-</textarea>
Now, your callback function should be work!