JohnHind
asked on
SELECT format columns
I have a SELECT listbox on a form that contains names and addresses. How can I make the address start at the same position/column ?
In VB I would put a tab character in the text, but I can't see anything like.
I'm using VB Webclasses to output the html stream. I could use a grid control, but it looks heavy going to format the grid each time.
Any suggestions ?
TIA
John
In VB I would put a tab character in the text, but I can't see anything like.
I'm using VB Webclasses to output the html stream. I could use a grid control, but it looks heavy going to format the grid each time.
Any suggestions ?
TIA
John
JohnHind,
What do you mean? Doesn't make sense.
You want to position a couple of elements at the same place? What elements?
You might be able to use layers and position them above each other.
I don't really get what you want. Tell us more.
CJ
What do you mean? Doesn't make sense.
You want to position a couple of elements at the same place? What elements?
You might be able to use layers and position them above each other.
I don't really get what you want. Tell us more.
CJ
CJ,
I think I can remember something similar creating forms in Access...
you can show more than one value, almost like a select with different columns to it...
BRUNO
I think I can remember something similar creating forms in Access...
you can show more than one value, almost like a select with different columns to it...
BRUNO
Oh that! :-)
try using the \t operand instead of a normal tab :-)
"\tblah"
try using the \t operand instead of a normal tab :-)
"\tblah"
when you say "position/column", you mean identation, probably using whitespace left of text?
Then simple answer: not possible
long answer: any method like using \t or %09 is not reliable, means it might work with a special browser of paricular version on uniq OS etc. etc.
IMHO, even using CSS is vasting time, unfortunately.
The only reliable method I know is to use printable characters, like a dash: -
Then simple answer: not possible
long answer: any method like using \t or %09 is not reliable, means it might work with a special browser of paricular version on uniq OS etc. etc.
IMHO, even using CSS is vasting time, unfortunately.
The only reliable method I know is to use printable characters, like a dash: -
ASKER
Here's the snippet. Basically, I need to change the commas for tabs, so I get columns - ie the addresses line up. Sounds like I can't do it.
<SELECT align=center id=lstMain size=20 name=lstMain style="WIDTH: 80%; HEIGHT: 60%"><option>Fred Smith, 1 The High Street, Nottingham<option>Joe Public, 2 Smith Street, Birmingham</SELECT>
John
<SELECT align=center id=lstMain size=20 name=lstMain style="WIDTH: 80%; HEIGHT: 60%"><option>Fred Smith, 1 The High Street, Nottingham<option>Joe Public, 2 Smith Street, Birmingham</SELECT>
John
separate your columns with pipe symbols (|) and then convert the pipes to a pre-determined number of spaces like this:
<HTML>
<HEAD>
<SCRIPT language='javascript'>
function padOptions(theSelect,L)
{
L = L||20; // 20 by default, if L is not specified
for ( var i=0,n=theSelect.options.le ngth; i<n; i++ )
{
var ta = theSelect.options[i].text. split("|") ;
for ( j=0,m=ta.length; j<m; j++ )
{
var D = L - ta[j].length;
for ( var k=0; k<D; k++)
ta[j] += " ";
}
theSelect.options[i].text = ta.join("");
}
}
</script>
</head>
<BODY onLoad='padOptions(documen t.myform.m yselect,20 );'>
<FORM name='myform'>
<FONT face='courier new'>
<SELECT name='myselect' style='font:9pt courier new;'>
<OPTION>col1|col2</option>
<OPTION>column1|column2</o ption>
<OPTION>This Is Column1|This Is Column2</option>
</select>
</font>
</form>
</body>
</html>
(I tested this in IE5+ and NS6 ... I doubt it will work in NS4)
<HTML>
<HEAD>
<SCRIPT language='javascript'>
function padOptions(theSelect,L)
{
L = L||20; // 20 by default, if L is not specified
for ( var i=0,n=theSelect.options.le
{
var ta = theSelect.options[i].text.
for ( j=0,m=ta.length; j<m; j++ )
{
var D = L - ta[j].length;
for ( var k=0; k<D; k++)
ta[j] += " ";
}
theSelect.options[i].text = ta.join("");
}
}
</script>
</head>
<BODY onLoad='padOptions(documen
<FORM name='myform'>
<FONT face='courier new'>
<SELECT name='myselect' style='font:9pt courier new;'>
<OPTION>col1|col2</option>
<OPTION>column1|column2</o
<OPTION>This Is Column1|This Is Column2</option>
</select>
</font>
</form>
</body>
</html>
(I tested this in IE5+ and NS6 ... I doubt it will work in NS4)
Sorry, I didn't see your last post until after I posted ... if you want to use commas instead, then change this:
var ta = theSelect.options[i].text. split("|") ;
to this:
var ta = theSelect.options[i].text. split(",") ;
var ta = theSelect.options[i].text.
to this:
var ta = theSelect.options[i].text.
also note the fixed-face font ... this is necessary.
You can also use the character to indicate 1 space. Works in most cases.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I'll give that a go.
thanks
John
thanks
John
can we see a code snippet?
BRUNO