Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: td() and Tr() inCGI.pm

by chipmunk (Parson)
on Nov 26, 2001 at 02:07 UTC ( #127430=note: print w/replies, xml ) Need Help??


in reply to td() and Tr() inCGI.pm

For the second row, use two separate calls to td(), instead of one combined call, and specify the appropriate attributes for each call.
print table( Tr( [ td(['First Name:', textfield(-name=>"first_name", -maxle +ngth=>25, -size=>12), 'Last Name:' , textfield(-name=>"last_name", -maxl +ength=>25, -size=>12) ]), join(' ', td('Address'), td({ -colspan=>2}, textarea(-na +me=>"address", -rows=>10, -columns=>50))), ] ) );

Replies are listed 'Best First'.
Re: Re: td() and Tr() inCGI.pm
by thunders (Priest) on Nov 26, 2001 at 07:28 UTC
    Thanks chipmunk that was what I was looking for, and using join() was clever. I had thought of using two td calls but I couldn't figure out how to do that in the context of Tr() without creating a new row.
      I agree it's an interesting trick, and I upvoted it because he answered your question in the way you asked him to, but from a general software engineering perspective it's a lousy practice. In this case there is no good reason to cram all those table cells into the smallest possible number of HTML shortcuts. The resulting code is hard to write, harder to read, and painful to maintain. This adds up to projects which take too long and cost too much if you code like this as a way of life. cLive;-)'s answer below is the Right Way to do this with HTML shortcuts.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://127430]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2020-01-26 22:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?