In your hooks/<tablename>-dv.js file
(replace the <tablename> with your actual tablename)

// Set input to reject space. File hooks/tablename-dv.js

$j('#<fieldname>').keyup(function () {

$j(this).val($j(this).val().replace(/s/g, ''));

});

(don’t forget to replace the <fieldname> with the corresponding fieldname)