Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Form generation

by DaWolf (Curate)
on Apr 22, 2005 at 15:28 UTC ( [id://450461]=note: print w/replies, xml ) Need Help??


in reply to 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.

The whole thing begins to get messy when you have to deal with styles and/or javascript handlers (onClick, onBlur, etc, etc...).

Replies are listed 'Best First'.
Re^2: Form generation
by matthewb (Curate) on Apr 22, 2005 at 16:34 UTC

    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 ;)


    MB
      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.

      Regards,

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2024-03-28 13:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found