[pmwiki-users] textarea and GUIButtons

Hans design5 at softflow.co.uk
Tue Mar 13 11:13:15 CDT 2007


Tuesday, March 13, 2007, 2:43:01 PM, Ben wrote:

> Guillermo wrote,
>> There is an easy way to obtain an input textarea with GUI Buttons like
>> the one of the edit form?
>> Thanks in advance.

> It's been requested: http://pmwiki.org/wiki/PITS/00877
> ... but unfortunately, no, currently the id of the textarea is
> hard-coded into the JavaScript that makes the buttons work.  To get it
> to work with other textareas would require rewriting the script and also
> the (:e_guiedit:) markup.  This could be done in a recipe, but I haven't
> gotten around to writing it yet.  Perhaps someone else would like to
> give it a shot?  --Ben

In scripts/stdconfig.php it says:

  if ($action=='edit' && IsEnabled($EnableGUIButtons,0))
    include_once("$FarmD/scripts/guiedit.php");

meaning guiedit.php is loaded only if $EnableGUIButtons = true;
and you are in edit mode (action=edit).

You can get the guibuttons working in other textarea boxes etc if you
load the script in config.php via

  include_once("$FarmD/scripts/guiedit.php");

and put in your (:input... markup: id=text
for instance for Fox comment box:

  (:input textarea id=text comment cols=60 rows=6:)

The gui javascript is looking for an element with id=text
to put its output into. Nothing too hardcoded.

Another solution I adopted is to copy the guiedit.php script and
modify it (change of function names, guibuttons, markup etc), and included it
as a cookbook script for my site.
Now I can use (:cbox_guiedit:) for commentboxes.
CommentBoxPlus has "id=text name=text" hardcoded.
I wrote about it here:
http://softflow.co.uk/design/Test/TestCommentBox2?p=2
You can download a zip file from there too: commentboxgui.zip


Hans




More information about the pmwiki-users mailing list