SID-00440: How do I edit a topic using a form
| Status: |
Answered |
TWiki version: |
4.0.3 |
Perl version: |
5.x |
| Category: |
CategoryEditing |
Server OS: |
Redhat Linux |
Last update: |
16 years ago |
This is more of an implementation question rather than a problem with TWiki itself.
How would I create a topic page such that a form on that page could edit the page itself. The effect I'm trying to achieve is similar to that with the form editing method of the TWiki preferences. I would like to be able to achieve the same effect but with either free text wrapped in specific identifyers or at worst custom TWiki Variables.
Can anyone help me?
--
JeremyWolstenCroft - 2009-07-27
Discussion and Answer
I did something like that for a change management application: when we click "Edit" on these special topics, we a form of your choosing, instead of the topic editor. But "Save and Continue" takes you through to the topic editor (which can be handy when trouble-shooting your application).
There are three pieces to this:
MyForm:
| *Name* | *Type* | *Size* | *Value* |
| Description | text | 117 | |
| DateOfChange | date | 12 | |
| ImplementationPlan | textarea | 120x16| |
| TestPlan | textarea | 120x8| |
| BackoutPlan | textarea | 120x4| |
MyTemplate (used to create new topics):
<!--
!!! PREFIX THESE BULLETS WITH THREE SPACES IN THE FINAL VERION. REMOVED THEM HERE TO DISABLE THEIR FUNCTIONALITY!!!
* Set VIEW_TEMPLATE = MyView
* Set EDITACTION = form
Hide the table row above the form that normally lets the user replace the form:
* Set COVER = noreplace
-->
MyViewTemplate:
%TMPL:INCLUDE{"view"}%
%TMPL:DEF{"content"}%%TMPL:P{"toolbar"}%
%TMPL:P{"topicpathinfo"}%%TMPL:P{"beforetext"}%%TMPL:P{"formattop"}%%TMPL:P{"attachmentsattop"}%<div class="patternContent">%TMPL:P{"customdisplay"}%%TMPL:P{"textcontent"}%%TMPL:P{"aftertext"}%%TMPL:P{"formatbottom"}%</div>
%TMPL:END%
%TMPL:DEF{"customdisplay"}%<div class="patternTopic">
---+!! %TOPIC%
| Description | %FORMFIELD{"Description"}% |
| Date of Change | %FORMFIELD{"DateOfChange"}% |
| Time of Change | %FORMFIELD{"TimeOfChange"}% |
etc.
</div>%TMPL:END%
--
SeanCMorgan - 2009-07-27
Very neat, thank you.
--
JeremyWolstenCroft - 2009-07-31
If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.