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

Re: CGI Tables, yippie!!

by robartes (Priest)
on Apr 03, 2003 at 13:01 UTC ( [id://247745]=note: print w/replies, xml ) Need Help??


in reply to CGI Tables, yippie!!

You need to seperate your Td() calls with commas. The way you are writing them causes the parser to interpret them as barewords (as evidenced by the error message).

Update: That fixed, you also need to lowercase Td to td. The CGI.pm function is called td, not Td. Funnily enough Tr is called Tr, to avoid confusion with the transliteration operator.

CU
Robartes-

Replies are listed 'Best First'.
Re: Re: CGI Tables, yippie!!
by sulfericacid (Deacon) on Apr 03, 2003 at 13:13 UTC
    Ok, I added the commas and the errors nearly disappeared! Thanks so much! But I have another problem though and since I'm really new to using CGI I don't exactly know how to debug things like this myself.

    The error I get this time is "Thu Apr 3 07:11:31 2003 tags.pl: syntax error at tags.pl line 39, near ");" ", any suggestions?

    It's kinda funny how it's Tr and td, but whatever works :)

    print start_form(), table( Tr(Td( "Email Address: "), Td(textfield('usermail')), Tr(Td("Author: "), Td(textfield('author')), Tr(Td("Distributor: "), Td(textfield('distributor')), Tr(Td("Copyright: "), Td(textfield('copyright')), Tr(Td("Abstract: "), Td(textfield('abstract')), Tr(Td("Keywords: "), Td(textarea(-name=>'keywords', -rows=>10, -columns=>50)), Tr(Td("Description: "), Td(textarea(-name=>'description', -rows=>10, -columns=>50))), Tr(Td("Robots: "), Td(popup_menu(-name=>'robots', -values=>['','index','noindex','follow','nofollow']))), Tr(Td("Distribution: "), Td(popup_menu(-name=>'distribution', -values=>['','local','global']))), Tr(Td("Language: "), Td(popup_menu(-name=>'language', -values=>['','EN','EN-GB','EN-US','ES','ES-ES','FR','IT +','JA','KO','DE']))), Tr(Td("Rating: "), Td(popup_menu(-name=>'rating', -values=>['','kids','general','mature','restricted']))) +, Tr(Td(), Td(submit)), end_form(), ), hr(); #### this is line 39


    "Age is nothing more than an inaccurate number bestowed upon us at birth as just another means for others to judge and classify us"

    sulfericacid
      Your first textarea is missing a ')' at the end.
      If you happen to use vim (or vi), the way to find such a thing is to put the cursor on the first (or last) '(' (or '{' or whatever) character and hit on '%'.
      In most cases this will jump to a place where the error is close.

      syntax error at tags.pl line 39, near ");" ", any suggestions?
      Your parentheses are unbalanced. On at least the first two "Tr" lines, you're opening more than you're closing.

      If your HTML is getting this complex, it might be time to look at HTML::Template or something similar.

      That's the one pita with CGI.pm tables - I love them, but you've got to keep bouncing on the "match bracket" key. It looks like this might be to do with a mis-matched bracket somewhere (but I don't see ');" "' on line 39 - puzzling)

      A minor point though (from a coding point of view, but important where your HTML validation is concerned) - you appear to have your 'start_form()' outside the table, while the 'end_form()' is inside it. Best to stick the end_form() outside too, so validators don't complain about your nesting.
      Cheers,
      Ben
      That's the reason why I always use print "<TR><TD>Blah blah blah</TD></TR>"; just because I know it works... :) (Yes, I know conceptually it's beautifull to reuse the tr & td code, but sometimes I feel that reinventing the wheel works best...)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2024-04-25 22:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found