[#1649] Advance search doesn't work if search value contains a special character followed by a space

Added validation of fields in advanced-search.js