Some refactoring for neatness and possible future expansion of directive capabilities
Use valid javascript function for only_integer (doesn't work still)