Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

strange output using -valign

by edwardsmarkf (Initiate)
on Jun 21, 2021 at 22:45 UTC ( #11134139=perlquestion: print w/replies, xml ) Need Help??

edwardsmarkf has asked for the wisdom of the Perl Monks concerning the following question:

hello - i am trying to format a large table in an existing perl script. when i use

$cgi->TR ( { -height => '100', -valign => 'bottom' } ...

the html is appearing with just:

<tr bottom height="100">

and i was hoping for this:

<tr valign='bottom' height="100">

it behaves as if somehow the "-valign" part is being "optimized" away, perhaps for a much older standard of html tables.
is there some easy workaround to this issue? i dont have time to re-do all this with some slick css option.

This is perl 5, version 26, subversion 3 (v5.26.3)

Replies are listed 'Best First'.
Re: strange output using -valign
by kcott (Archbishop) on Jun 22, 2021 at 06:16 UTC

    G'day edwardsmarkf,

    Welcome to the Monastery.

    You have a simple typo. The '=' in "-valign = 'bottom'" should be '=>'; cf. "-height => '100'".

    — Ken

      that was typo, sorry. similar to the "stubmit" button on the perlmonks edit page. 😁 had i used the code without the arrow, i assume it would have thrown an error.

        You have changed the text of your post without indicating that you did so.

        My post, with "-valign = 'bottom'", will not make sense to subsequent readers. I also see that tangent has wasted time trying figure out what's wrong with "-valign => 'bottom'" (see his post).

        I know you're new here and I'm not trying to beat over the head with a rule book. It is fine to make edits to your posts but you need to indicate what you've changed. Please read "How do I change/delete my post?" and add an Update: paragraph to your post.

        — Ken

Re: strange output using -valign
by tangent (Vicar) on Jun 22, 2021 at 21:11 UTC
    Are you sure there isn't a mistake somewhere else - maybe post some more context. When I run your example it works fine. Using CGI version 4.44
    use CGI; my $cgi = CGI->new; my $html = $cgi->TR( { -height => '100', -valign => 'bottom' }, [ $cgi->th(['Vegetable', 'Breakfast','Lunch','Dinner']), $cgi->td(['Tomatoes' , 'no', 'yes', 'yes']), ] ); print "$html";
    <tr height="100" valign="bottom"> <th>Vegetable</th> <th>Breakfast</th> <th>Lunch</th> <th>Dinner</th> </tr> <tr height="100" valign="bottom"> <td>Tomatoes</td> <td>no</td> <td>yes</td> <td>yes</td> </tr>
Re: strange output using -valign
by hippo (Bishop) on Jun 22, 2021 at 08:49 UTC
Re: strange output using -valign
by shmem (Chancellor) on Jun 22, 2021 at 04:29 UTC
    is there some easy workaround to this issue?

    Quick fix:

    print q(<tr valign="bottom" height="100">);
    perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'
Re: strange output using -valign
by AnomalousMonk (Bishop) on Jun 22, 2021 at 00:23 UTC
Re: strange output using -valign ( version?)
by Anonymous Monk on Jun 22, 2021 at 02:36 UTC
    ( version?) Make your own function? Switch to templates? Take over support and start fixing html generation bugs? The choice is yours :;)

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://11134139]
Approved by GrandFather
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (2)
As of 2022-08-14 21:36 GMT
Find Nodes?
    Voting Booth?

    No recent polls found