Gossamer Forum
Home : General : Perl Programming :

Formatting multiple columns in SELECT tag

Quote Reply
Formatting multiple columns in SELECT tag
I using Perl cgi for my web site and can't seem to format the SELECT tag when using 3 columns of data (userid, full username, and phone number). I've tried PACK statements, tabs, etc with no luck. Will consider using a javascript if necessary. I've spent a lot of time on this and is used throughout my web....any help would be appreciated.
Quote Reply
Re: [samtek] Formatting multiple columns in SELECT tag In reply to
You should describe in more details what you want.
If I understand correctly, multiple columns is not possible SELECT tag, but I may misunderstand the problem.

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Quote Reply
Re: [webmaster33] Formatting multiple columns in SELECT tag In reply to
I'm sorry, I thought I was specific....but I think you answered my question. I have three separate columns that shows up in the SELECT tag box -- all of which are variable lengths. I was trying to format so the first column with the userid's displayed were always 16 characters, the second "column" always 25 characters, etc. I tried using the PACK statement to pad spaces and tried to insert a \t (tab), I even tried to pad with &NBSP for USERID'S less than 16 characters in length -- none of the format attempts were recognized and the &NBSP doesn't work in the way I was trying to use it. Each line of the SELECT would contain USERID FULLNAME PHONE. I would consider a javascript that would allow me to just have the userid in the SELECT box, but would display the full user name on MOUSEOVER. I just haven't been able to make this happen....and would really appreciate help.

Last edited by:

samtek: Mar 23, 2005, 3:44 PM
Quote Reply
Re: [samtek] Formatting multiple columns in SELECT tag In reply to
You should try to show examples.
That's too complicated described this way...

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Quote Reply
Re: [webmaster33] Formatting multiple columns in SELECT tag In reply to
Okay....examples. Below are two examples of trying to format the line within a SELECT box :

Sample Line Output: maryjane Mary Jane LaRiviere 206.304.4464
rocky1009 Rocky Mayberry 206.304.4464

Desired Output: maryjane Mary Jane LaRiviere 206.304.4464
rocky1009 Rocky Mayberry 206.304.4464

One:

print qq(<select name="chgusr" size=15>);
my $cnt=1;
while ($cnt <= $lcnt ){
$lnr=substr($newdata,$sbyte,16);$sbyte+=16;
$lnm=substr($newdata,$sbyte,40);$sbyte+=40;
$lph=substr($newdata,$sbyte,24);$sbyte+=24;
print qq(<option value=$lnr>$lnr\&nbsp\&nbsp\&nbsp\&nbsp\&nbsp\&nbsp\&nbsp\&nbsp\&nbsp$lnm\&nbsp\&nbsp\&nbsp\&nbsp\&nbsp\&nbsp\&nbsp\&nbsp\&nbsp$lph \n);
$cnt++;
}
print qq(</select>);

Two:

print qq(<select name="chgusr" size=15>);
my $cnt=1;
while ($cnt <= $lcnt ){
$lnr=substr($newdata,$sbyte,16);$sbyte+=16;
$lnm=substr($newdata,$sbyte,40);$sbyte+=40;
$lph=substr($newdata,$sbyte,24);$sbyte+=24;
$fcnt=length($lnr);
$outfmt=$lnr;
while ($fcnt <= 16){
$outfmt=($outfmt."\&nbsp");
$fcnt++;
}
print qq(<option value=$lnr>$lnr $outfmt $lnm\n);
$cnt++;
}
print qq(</select>);


If there is some kind of javascript that could allow me to just have the "$lnr" in the SELECT box and expand the "$lnm" on MOUSEOVER via javascript or whatever...that would work fine. Right now I use this throughout my program....whether it is userids, groups, addresses, etc.

Thanks for your help webmaster33.
Quote Reply
Re: [webmaster33] Formatting multiple columns in SELECT tag In reply to
Second attempt since the below sample Outputs didn't stay formatted.
Okay....examples. Below are two examples of trying to format the line within a SELECT box :

Sample Line Output (the three fields should line up ...userid fullname phone):
maryjane Mary Jane LaRiviere 206.304.4464
rocky1009 Rocky Mayberry 206.304.4464

Example One:

print qq(<select name="chgusr" size=15>);
my $cnt=1;
while ($cnt <= $lcnt ){
$lnr=substr($newdata,$sbyte,16);$sbyte+=16;
$lnm=substr($newdata,$sbyte,40);$sbyte+=40;
$lph=substr($newdata,$sbyte,24);$sbyte+=24;
print qq(<option value=$lnr>$lnr\&nbsp\&nbsp\&nbsp\&nbsp\&nbsp\&nbsp\&nbsp\&nbsp\&nbsp$lnm\&nbsp\&nbsp\&nbsp\&nbsp\&nbsp\&nbsp\&nbsp\&nbsp\&nbsp$lph \n);
$cnt++;
}
print qq(</select>);

Example Two:

print qq(<select name="chgusr" size=15>);
my $cnt=1;
while ($cnt <= $lcnt ){
$lnr=substr($newdata,$sbyte,16);$sbyte+=16;
$lnm=substr($newdata,$sbyte,40);$sbyte+=40;
$lph=substr($newdata,$sbyte,24);$sbyte+=24;
$fcnt=length($lnr);
$outfmt=$lnr;
while ($fcnt <= 16){
$outfmt=($outfmt."\&nbsp");
$fcnt++;
}
print qq(<option value=$lnr>$lnr $outfmt $lnm\n);
$cnt++;
}
print qq(</select>);


If there is some kind of javascript that could allow me to just have the "$lnr" in the SELECT box and expand the "$lnm" on MOUSEOVER via javascript or whatever...that would work fine. Right now I use this throughout my program....whether it is userids, groups, addresses, etc.

Thanks for your help webmaster33.
Quote Reply
Re: [samtek] Formatting multiple columns in SELECT tag In reply to
I think I got it, what you want.
But as far as I can remember, your current solution, is the only possible solution (to format using spaces).

Also you might want to read about Perl's format function:
http://perldoc.com/...pod/func/format.html
http://perldoc.com/....4/pod/perlform.html


You might also want to check CSS, to see if there is any helpful feature. I'm not CSS expert, but others may help you.

That's all I can suggest.

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...