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

by Hero Zzyzzx (Curate)
on Dec 15, 2004 at 19:46 UTC ( #415172=perlquestion: print w/replies, xml ) Need Help??
Hero Zzyzzx has asked for the wisdom of the Perl Monks concerning the following question:


I use to generate all my form elements and the automagical stuff it does in the background is usually helpful, but not in this case.

I'm integrating a through-the-web WYSIWYG editor with a content management system. One way you can tell it to take control of a field is to add an attribute named "mce_editable" to a <textarea> tag. Unfortunately, CGI automatically turns "_" in attributes into hyphens.


$edit_form->{SQUIB_OUTPUT}=$q->textarea(-name=>'squib',-rows=>5,-colum +ns=>90,-wrap=>'virtual',-value=>$squib,-mce_editable=>1);
<textarea name="squib" rows="5" cols="90" mce-editable="1" wrap="virtu +al"></textarea>
when I want it to output:
<textarea name="squib" rows="5" cols="90" mce_editable="1" wrap="virtu +al"></textarea>

I'm not sure if "_" are valid in attribute names, and a quick glance at the HTML4 DTD didn't answer that question for me. I've also looked at the source and nothing jumped out at me.

Ideas? Any other options other than subclassing to make textareas work the way I want?

-Any sufficiently advanced technology is
indistinguishable from doubletalk.

My Biz

Replies are listed 'Best First'.
Re: tag attributes and underscores
by trammell (Priest) on Dec 15, 2004 at 21:29 UTC
    I found this in perldoc CGI:
    Many routines will do something useful with a named argument that it doesn't recognize. For example, you can produce non-standard HTTP header fields by providing them as named arguments: print $q->header(-type => 'text/html', -cost => 'Three smackers', -annoyance_level => 'high', -complaints_to => 'bit bucket'); This will produce the following nonstandard HTTP header: HTTP/1.0 200 OK Cost: Three smackers Annoyance-level: high Complaints-to: bit bucket Content-type: text/html Notice the way that underscores are translated automatically into hyphens. HTML-generating routines perform a different type of translation.

      This is a solved issue, but to reply to your question: I've read and referred to the CGI docs probably hundreds of times. I feel I've got a pretty good grasp on most everything the module does.

      My question was specifically about how one would control/turn off the "underscore to hyphen" translation. Thanks, though!

      -Any sufficiently advanced technology is
      indistinguishable from doubletalk.

      My Biz

Re: tag attributes and underscores
by Hero Zzyzzx (Curate) on Dec 15, 2004 at 20:02 UTC

    Fuggedaboutit. You can just rename the trigger attribute to something that doesn't contain the underscore right in the tinyMCE configuration. Please delete this question.

    -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: perlquestion [id://415172]
Approved by kutsu
[hippo]: How did you install libapreq2?
[vedagiri89]: that one is done by system team from the tar i guess
[hippo]: Really? Not using the one from the CentOS repository? Perhaps that's the problem.
[vedagiri89]: i need when this issue will come usually
[hippo]: How about mod_perl? Was that installed from the CentOS packge or from source?
[vedagiri89]: from the source
[hippo]: But is under vendor_perl in your error message so you are mixing up modules installed from the packager and by hand. That's rarely a good plan.
[vedagiri89]: the prm fine if i run file directly..not working if i run through apache http file
[hippo]: Environments differ.

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

    Results (113 votes). Check out past polls.