Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

CGI.pm 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:

Folks,

I use CGI.pm 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.

So:

$edit_form->{SQUIB_OUTPUT}=$q->textarea(-name=>'squib',-rows=>5,-colum +ns=>90,-wrap=>'virtual',-value=>$squib,-mce_editable=>1);
outputs:
<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 CGI.pm source and nothing jumped out at me.

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

-Any sufficiently advanced technology is
indistinguishable from doubletalk.

My Biz

Comment on CGI.pm tag attributes and underscores
Select or Download Code
Re: CGI.pm 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

Re: CGI.pm 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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://415172]
Approved by kutsu
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2014-07-31 02:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (244 votes), past polls