Click here to Skip to main content
15,881,812 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

Let's say I put a combobox in a web page and that I want to show the project ID and the project name in each row of that combobox (I can have the same name for different projects but a unique ID).

I'd like to be able to use a "tab" ("\t") to separate the columns of the combobox options, but even I've tried it it only puts a space there.

as an example:
PHP
$return_string[$i] = $row['id']."\t::\t".$row['name'];

But this shows:
1234 :: name of the project

It could be the first tab would need only one space, but not the second one...

What am I doing wrong here?

And in case it is not possible to put a tab inside a string to be shown afterwards...

How could I do it?

Thank you very much!

What I have tried:

Using '\t', "t" standalone without the other text, "\t::\t" too...
Posted
Updated 10-Aug-19 9:06am
Comments
Richard MacCutchan 10-Aug-19 11:37am    
I suspect the Combobox does not recognise the tab character. What happens if you display the text in a normal text field?
Joan M 10-Aug-19 13:21pm    
Exactly the same... how strange...
Richard MacCutchan 11-Aug-19 4:30am    
I ran a simple PHP script to print some text, and the tabs worked fine. As you say, how strange.
Joan M 11-Aug-19 4:41am    
I must be making something wrong... Thank you I'll retry...
Richard MacCutchan 11-Aug-19 5:41am    
The documentation states that a string surrounded by double quotes (as you have in your example) will interpret \t correctly. I think you need to do some deep debugging - good luck.

1 solution

Pad the "left column" out to the width you want and concatenate with the column to the right. You can even put a "|" in between. Mono font maybe.
 
Share this answer
 
Comments
Joan M 11-Aug-19 4:40am    
Sorry, but I'm very newbie here... can you explain it a little bit more, give some small sample or a link to follow?

thanks!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900