[pmwiki-users] Help to toggle wrap for textarea in edit-form

Daniel Andersson list at daniel-gr-andersson.com
Thu May 5 06:25:31 CDT 2011


Hi all

I want to toggle wrap for the textarea in the edit-form, since I edit 
broad simple tables 50 times a day.

I have some working HTML javascript code to do this below.
What is the best way to go about this?

When I edit my Site.EditForm from PmWiki I find (:input e_textarea:), 
but I'm not sure how to insert my HTML and Javascript here.

<HTML>
<BODY>
   <SCRIPT type='text/javascript'><!--
     function set_wrap(b, t) {
     var ta = document.getElementById(t), n = ta.cloneNode(true); 

     n.setAttribute('wrap', b.options[b.selectedIndex].value);
     ta.parentNode.replaceChild(n, ta);
     }
   --></SCRIPT>
   <FORM>
     <TEXTAREA id='off' cols='15' wrap='off'>One, Two, Three, Four, 
Five, Six, Seven, Eight, Nine, Ten</TEXTAREA>
       <SELECT onChange='set_wrap( this, "off" );'>
         <OPTION value='soft'>soft</OPTION>
         <OPTION value='off' selected>off</OPTION>
         <OPTION value='hard'>hard</OPTION>
       </SELECT>
   </FORM>
</BODY>
</HTML>


PS. Any tip of a Firefox add-on to toggle wrap compatible with Firefox 
3.5? Wrap Switcher 1.1 only works with 3.0.


Cheers
Daniel



More information about the pmwiki-users mailing list