Trim search box fields

We are having an issue where users are copying data from another source like excel and pasting it into the search but there is an extra space at the end of the string, so the search results show 0 results. For example a user will paste '[email protected] ' and nothing will show even though '[email protected]' is in the database. Is there any way to automatically trim a search field? 

Thanks!
Anthony

Parents Reply
  • 0 in reply to Kieron Moran

    That will stop you when typing in a name that has an actual space.

    You could trigger the trim() only if the space key has not been hit:

    crm.ready(()=> {
        $('#pers_firtname').on('keyup', (e)=> {
            // trim only if spacebar not hit.
            if (e.keyCode != 32) {
                $('#pers_firtname').val($('#pers_firtname').val().trim());
            }
        });
        // ...
    });

Children
No Data