You can make your filed mandatory to avoid JS.
You can write your validation script under "Validate" expression.
If you are using rule editor its quite simple.
One sample validation is -
this.value !==null or this.isNull() for blank fields. Just write this script in validate expression.
Many thanks Hitesh for the reply can you share a sample form. Then I can learn. (I m pretty new to AEM software) :D
Sorry, but this.value != "" isn't a good validation (see here on page 18).
You better use
this.rawValue !== null;
or the built-in method isNull() to check a fields value against null.
Thanks. I updated the answer !