+ Start a Discussion

padding spaces in SelectOption label

Is there a technique for padding spaces in the label when creating SelectOption instances in a controller?  The multiple spaces I put in get trimmed to a single space.

Abhay AroraAbhay Arora

Try adding   in your string these spaces will not be truncated


  is the first thing I tried.  I ended up with literally   in the label.  I tried option.setEscapeItem(true);.  Same result.


Hi there,

Did you ever find a solution? I'm struggling with the same..




Its long ago for me to remember the exact circumstances.  I looked at my application and the only thing close to this problem is I embed a space in the middle of

a SelectOption label.  Its straightforward, so I don't think its the same issue for my original post.


Is your problem padding spaces on the ends?  If so, I either did not find a solution and gave up; or my requirements changed and I no longer needed to do it.


Sorry, not much help.


I embed multiple spaces in the middle of the label, so that I can line-up the last words in the labels. The spaces get trimmed back to 1 single space, though.




In that case, I can only assume I never found a solution.  I embed a single space.

I remember fighting for a long time and I tried everything I could think of.