Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

Monks and mongers,

Time and again, I find myself bored silly producing XHTML forms to perform some piece of business logic which is, to some extent, coupled to a database. Indeed, so common is this requirement that I'm pushed to think of a project I've been involved in that didn't involve such an interface at some point.

Laziness, impatience, hubris...”, we echo but how to be lazy, here? I'm getting impatient.

Solutions exist that purport to solve this problem through the auto-generation of semi-intelligent forms. They appear feasible because it's a problem that sounds like it should be solvable.

I've previously noded my frustrations with Class::DBI::AsForm; I've worked with and tried to like FormBuilder but find myself feeling that something is not right. I'd feel comfortable knowing that information pertaining to the database (model) is closely coupled to it but at what point do we feel that form generation becomes display logic?

And anyone who has done web development beyond the one-man pet project will know that it inevitably involves a graphic designer whose principal skill seems to be devising convoluted means to defy your generated forms. A similar frustration is that requirements are so often more complex than simple CRUD.

I'm looking for a generic and reusable solution that, critically, is not more work or less flexible that making a library of Template Toolkit forms and being done with it.

Naturally, I was interested in merlyn's remarks the other day concerning the storage of column meta-data in a config file accessible through your Class::DBI-derived classes. Seems like a good idea and I hacked around with it that evening on a test machine. I've seen similar solutions using a database table to store meta-data before. But what meta-data to store? XHTML tag for representation? XHTML attributes? Default value? Order to appear in? User permissions? Would it be a good idea, taking the example from Class::DBI::AsForm, to somehow return HTML::Element objects for easy manipulation within templates?

And then, of course, it hits you: you've gone and defined a mini-language that does the same thing as XHTML just without being as easy to edit in emacs.

I'm interested in a general discussion on best practice and other people's experiences in this area; what are the gurus among us doing that I'm somehow missing?

Update: <readmore>s requested by tlm. I marked this OT originally because the problem is not specific to Perl. Thanks for all the replies. MB.


MB

In reply to Form generation by matthewb

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

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

    How do I use this? | Other CB clients
    Other Users?
    Others cooling their heels in the Monastery: (5)
    As of 2021-03-07 09:56 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      My favorite kind of desktop background is:











      Results (120 votes). Check out past polls.

      Notices?