Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Re^2: HTML::Template recalling selected dropdown options

by bradcathey (Prior)
on May 12, 2005 at 12:24 UTC ( #456360=note: print w/replies, xml ) Need Help??

in reply to Re: HTML::Template recalling selected dropdown options
in thread HTML::Template recalling selected dropdown options

Thanks, I did consider this, but I have this "thing" about keeping as much of the HTML as possible on the HTML side (but even Sam himself doesn't have this hang-up, and I quote from the H::T doc:

"To some people this smacks of mixing HTML and code in a way that they hoped HTML::Template would help them avoid. To them Iíd say that HTML is a violation of the principle of separating design from programming. Thereís no clear separation between the programmatic elements of the <form> tags and the layout of the <form> tags. Youíll have to draw the line somewhere - clearly the designer canít be entirely in charge of form creation. Itís a balancing act and you have to weigh the pros and cons on each side. It is certainly possible to produce a <select> element entirely inside the template. What you end up with is a ratís nest of loops and conditionals. Alternately you can give up a certain amount of flexibility in return for vastly simplifying your templates. I generally choose the latter."

I guess if popup_menu() can help me avoid the mess of javascript/html/Perl then it might be worth a closer look.

"The important work of moving the world forward does not wait to be done by perfect men." George Eliot
  • Comment on Re^2: HTML::Template recalling selected dropdown options

Replies are listed 'Best First'.
Re^3: HTML::Template recalling selected dropdown options
by Hero Zzyzzx (Curate) on May 12, 2005 at 13:49 UTC

    popup_menu() (and checkbox_group(), radio_group(), etc) can absolutely simplify your templates, on large forms you'll see a huge difference. Personally I haven't often had the need to edit form fields directly as HTML, because you can apply a class to the field and change much of it's appearance with CSS. Most field options are created off database queries, seldom are select/radio/check lists hardcoded.

    I only use to parse values, print headers, handle uploads and create HTML Forms (though I've started to use CGI::FormBuilder for most of my forms). On trivial apps I'll use the HTML generation features, too. For me, I think this is's "highest and best" use- the tricky stuff that doesn't usually impact design is handled by a library that does it EXTREMELY well.

    The way I think of it- you can absolutely save yourself time generating the HTML form fields with CGI, and in those cases where you just can't because of some design problem (which is pretty rare, in my experience), you can always fall back to manual form element generation. In the meantime, you've still come out ahead, with smart forms and saved effort.

    -Any sufficiently advanced technology is
    indistinguishable from doubletalk.

    My Biz

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://456360]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (3)
As of 2018-06-19 03:59 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (111 votes). Check out past polls.