This project has moved and is read-only. For the latest updates, please go here.

SPServices.SPAutocomplete + double spaces

Sep 1, 2011 at 3:25 AM

Basic question:

Im having a problem using SPServices.SPAutocomplete, that it removes double spaces from the sourceColumn that its referencing, I don’t know if anybody has come across this and if there is an easy work around.
Im using IE.  


Long explanations:
I am setting up a list to gather information about different projects staff are working on, It have two lookup fields from two different lists, projects, and project phases.

So the fields:
Project – that is a concatenated lookup field of the project number and title, ‘6666-0123-00 - Manor Park - Area D’.  I uses the SPServices.SPAutocomplete.  This allows staff to enter part of the name or the project number and select the correct project, then select from the list.


Project phase, each project can have about 10 phases, these phase numbers are not generic but assigned to each project .
Im using SPCascadeDropdowns on this field.

My issue is that some of the project names have two spaces in them.

When I do an auto complete the second spaces are removed when text is entered into the input field. 


So I have a project
000-1111-2222 – Parkland(Double Space)research project

Becomes after doing an auto complete:
000-1111-2222 – Parkland(Single Space)research project

So then SPCascadeDropdowns on the phase filed fails because the project name doesn’t exist.


I guess this is an issue with HTML and the way it deals with double spaces but is there an easy fix.


I guess I can process the data in my lookup lists to remove the double spaces.


Sep 1, 2011 at 5:29 AM

I have decided to just process out the double spaces before the data is put into SharePoint, i have separate lookup column in each list, this has fixed the issue, but I am still curious to see if there is a fix to the problem.  

Sep 1, 2011 at 3:27 PM


Frankly, I'm not sure what's happening. I don't think there's anything in my code which would remove the extra space.

SPCascadeDropdowns requires that both the parent and child column be lookups, however. The input element (Single line of text) that you are using with the SPAutocomplete function can't be a parent for SPCascadeLookups because it isn't a lookup column.


Sep 2, 2011 at 12:45 AM

I guess I overcomplicated the question, just wanted to outline why it was an issues.  Can forget about the SPCascadeDropdowns part, it happened with or without it. 

Seem it is only is an issue in internet explorer, chrome seems fine but it really has to work the same in both.

If you have two standard custom lists with just a Title columns in each, and use one to auto complete other, have a few random entries in the parent list, when you select the items some from the auto complete list, any items with double spaces will have the doubles spaces removed, this is under IE 8, under chrome the double spaces remain.