Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Re^2: Form generation

by matthewb (Curate)
on Apr 22, 2005 at 16:34 UTC ( #450479=note: print w/replies, xml ) Need Help??

in reply to Re: Form generation
in thread Form generation

Speaking about the theory of this I was thinking about making a script that does something like:

Foreach field of the table fetch the field name, data type and length. Then generate the html tag according to this information.

I think this is quite easy to do.

As I say, it does sound like a solvable problem, this is the central premise behind Class::DBI::AsForm.

But this supposition breaks down quite quickly when developing applications for the typical (read:awkward) client. How can portability be maintained across DB servers? What about business-specific requirements for form fields such as something as simple as them wanting a <select> where a text input is implied by the schema.

Often you'll have a couple of TEXT fields, one of which they want to be really large for some reason. In a drunker moment I once set about hacking AsForm to read existing entries in TEXT fields and try to assign appropriate rows and cols attributes based on existing entries (!).

Look at how Maypole gets on going down this route: for all the hype about not having to type out your column names even the simplest application will require you to type them out three times to get anything resembling professionalism (to define the headings the user sees, the untaint rules, the relationships etc.)

The consensus seems to be what I feared but have always ended up with in the past - it's still less work and more maintainable just to make the things yourself and get on with something else ;)


Replies are listed 'Best First'.
Re^3: Form generation
by DaWolf (Curate) on Apr 22, 2005 at 18:39 UTC
    Well, I can't say that you are wrong.

    Althrough it's extremely boring (as you've already posted), doing all "by hand" seems to be the only way to get the final result to be exactly as expected. (excuse my english, I'm a foreigner)

    I've forgot to mention that this "marvelous script" that I was thinking about is meant to make things a little easier, but *never* to fully automate the whole job - yes, it sounds like a doable thing, but I have serious doubts about it...

    Anyway, my whole point is quite the same as the center of your post: the concern about having to type everything, but feeling/fearing that this is the only way.


Log In?

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2021-03-02 23:59 GMT
Find Nodes?
    Voting Booth?
    My favorite kind of desktop background is:

    Results (67 votes). Check out past polls.