• Do not register here on develop.twiki.org, login with your twiki.org account.
• Use View topic Item7848 for generic doc work for TWiki-6.1.1. Use View topic Item7851 for doc work on extensions that are not part of a release. More... Close
• Anything you create or change in standard webs (Main, TWiki, Sandbox etc) will be automatically reverted on every SVN update.
Does this site look broken?. Use the LitterTray web for test cases.

Item5547: "action" parameter for "edit" script fail in 4.2

Item Form Data

AppliesTo: Component: Priority: CurrentState: WaitingFor: TargetRelease ReleasedIn
Engine Templates Urgent Closed   patch  

Edit Form Data

Reported By:
Applies To:
Current State:
Waiting For:
Target Release:
Released In:


I used
<input type="hidden" name="action" value="form" />
in my form (also with templatetopic & formtemplate parameter) and I expect to edit the form only but bring in my topic template content in background. This background action is work in 4.1.2 but fail in 4.2!

There are 2 test pages: with and without "action" parameter in development site. You can find that:

  • When without "action" parameter, new created topic has my topic template's content and also has my form attached (below) in it! It looks good!
  • When with "action" parameter, content in EvaluationTemplate didn't appear in new created topic!

Another note:

  • content in EvaluationTemplate that bring in to new topic without "action" is strange %3C%21--%0A%20%20%20*%20ALLOWTOPICVIEW%20%3D%20Main.MagicYang%0A%20%20%20*%20ALLOWTOPICCHANGE%20%3D%20Main.MagicYang%0A%20%20%20*%20Set%20VIEW_TEMPLATE%20%3D%20Main.PatternSkinUserView%0A--%3E%0A

-- TWiki:Main/MagicYang - 17 Apr 2008

TWikiScripts documents action=form as follows: Use the editaction template instead of the standard edit. If action=text, then hide the form. If action=form hide the normal text area and only edit the form.

To start with I'm not sure what Use the editaction template is meant to mean. There is no editaction parameter and no editaction template in the standard template set. There is a $editaction variable in the Edit.pm module, so I guess it's referring to this. Reading the code, here's what happens:

The template is determined as follows:

  1. If the template parameter is given, then that is taken, else
  2. If the EDIT_TEMPLATE TWiki variable is defined, that is taken, else
  3. the template name is edit. This is the case in the example given.

Now the value of the action parameter is appended to the template name, so in the example (where action=form) the template name is editform. There is no editform.pattern.tpl so this results in editform.tmpl being loaded for the edit.

In 4.1.2 this template included the line <input type="hidden" id="topic" name="text" value="%TEXT%" /> which would have sufficed to pull the text into the form. However this has been removed from the 4.2.0 templates (TWikirev:14337 against Item4142) to cause this bug.

I don't know why this was removed, but a possible workaround is to modify the editform.tmpl locally as follows:

Index: editform.tmpl
--- editform.tmpl    (revision 16719)
+++ editform.tmpl    (working copy)
@@ -7,4 +7,5 @@
+<textarea style="display:none" name="text">%TEXT%</textarea>

This really needs Arthur to review my analysis.

-- CrawfordCurrie - 30 Apr 2008

Dear Crawford,

Thanks for your analysis and I learn so much! I try your fix and it works on 4.2, only with a little pity that there is still a little editor below! Is it possible to make this editor really invisible? (I don't know why style="display:none" does not work!)

BTW, I find another bug in both 4.1.2 & 4.2 Item5598!!

-- TWiki:Main.MagicYang - 02 May 2008

You can try to wrap the (normal) textarea inside an invisible div.

-- TWiki:Main.ArthurClemens - 02 May 2008

Or simply use

<input type="hidden" id="topic" name="text" value="%TEXT%" /> 
as was in the 4.1.2 templates.

-- TWiki:Main.CrawfordCurrie - 02 May 2008

I like simpleness...

-- TWiki:Main.ArthurClemens - 02 May 2008


<input type="hidden" id="topic" name="text" value="%TEXT%" /> 
tinymce does create a wysiwyg editor.

I have put a hidden div around it for now as I cannot see how to prevent TMCE to not create the wysiwyg editor for a hidden field.

Perhaps Crawford can shed a light on this.

-- TWiki:Main.ArthurClemens - 02 May 2008

It's because we changed Tiny MCE to use the name of the from element text to instantiate the editor ( elements : "text" in %TINYMCEPLUGIN_INIT% ). It doesn't matter that it's a type="hidden", it still goes ahead and replaces that form element. The documentation claims that elements is a list of IDs, but it appears it works off element names and not IDs.

After a bit of experimentation I've concluded that the best approach is to use mode:"textareas",editor_selector:"twikiTextarea" instead. This has a number of advantages:

  1. we can use the text parameter without Tiny MCE camping where it isn't wanted,
  2. twikiTextarea is a class that is only applied to the main edit area,
  3. in the future if we want WYSIWYG in form fields, all we have to do is change it to edit_selector:"(twikiTextarea|twikiEditFormTextAreaField)"

Can you see any reason not to do this?

-- CrawfordCurrie - 03 May 2008

That seems the right approach. But I am wary of the extra css class twikiEditFormTextAreaField.

-- TWiki:Main.ArthurClemens - 03 May 2008

twikiEditFormTextAreaField is one of your classes, and we'd only use it if we added the code to support WYSIWYG of form field entries (something that would be trivial to do, but no-one has asked me for yet)

I'll go ahead with the change.

Done. You could get rid of the invisible div, but I guess it doesn't do any harm.

-- TWiki:Main.CrawfordCurrie - 04 May 2008

Summary "action" parameter for "edit" script fail in 4.2
ReportedBy TWiki:Main.MagicYang
Codebase 4.2.0
SVN Range TWiki-5.0.0, Tue, 15 Apr 2008, build 16676
AppliesTo Engine
Component Templates
Priority Urgent
CurrentState Closed

Checkins TWikirev:16759 TWikirev:16760 TWikirev:16767 TWikirev:16768
TargetRelease patch

Edit | Attach | Watch | Print version | History: r17 < r16 < r15 < r14 < r13 | Backlinks | Raw View |  Raw edit | More topic actions
Topic revision: r17 - 2008-08-04 - KennethLavrsen
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback