This just kept me tied up for 3 hours. I was allowing a customer to select multiple values from a html select box then processing the values after splitting them into an array, like this:
sCompetencies = Request.Form("competencies")
aCompetencies = split(sCompetencies & ",",",")
'aCompetencies is now an array that holds all the clients selections
Now this worked just fine for many months until the client noticed that previously selected values were not being found. After scanning the SQL table I found the missing competencies, but they all had leading spaces?
After much head scratching and lots of debugging I found that HTML feeds multi-select option values delimited with a
comma and a space! My code split the values just fine but the second and subsequent values all had the space at the beginning, which I was writing to my SQL Table.
I repaired the table values and everywhere I use the above code I added the following after the split line:
for i= 0 to ubound(aCompetencies) - 1 ' for each competency that the course awards
aCompetencies(i) = trim(aCompetencies(i)) ' remove spaces !!!!!!!!!!!!!!!!!!!!!!!!!!
next
Problem solved