Ahoy! @Francois I also tried field validation rules with regex and didn’t have much luck!
Below is the JavaScript method. When a white space is added to field_xx
, it will automatically erase it on keyup. Hope that helps.
$(document).on('knack-view-render.any', function(event, scene) {
// Prevent whitespace input in a text field with key 'field_xx
$('#field_xx').on('input', function() {
this.value = this.value.replace(/\s/g, '');
});
});