Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

If you're asking whether a form CGI can take its format from the structure of a database table, the answer is Yes.

If you're asking if that's a good plan, the answer is Probably Not. :)

The short answer to that is you'll probably end up in a situation where you don't want each column to be represented by a form field, so you'll start to make exceptions. And that way madness lies.

Instead, I use Template::Toolkit to lay out the form, and I may use an array of field names in the CGI to collect information and put it into the database. That way, the CGI form field names are the same as the database field names. And I use CGI::Application as the application framework .. it works well.

Alex / talexb / Toronto

"Groklaw is the open-source mentality applied to legal research" ~ Linus Torvalds

Update at 9am, February 13, 2007: I approved this post under Meditations because it doesn't ask a specific question, but rather a general, conceptual question. The anticipated answer would be general thoughts on the topic, and not Here's three lines of code that would solve your problem.


In reply to Re: Migrating database field values rules from Perl code to DB by talexb
in thread Migrating database field values rules from Perl code to DB by punch_card_don

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (6)
As of 2024-04-20 00:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found