Tags:
create new tag
view all tags

Question

I searched through every 'form' tagged previous answer for this and am amazed I didn't see the same question - so either it is something blindingly obvious I am missing or people are really good at getting their template designs right the first time.

I have a HTML form to create topics based on user input (using AUTOINC0001) and a template that the topics are created with.

This all works fine. If I change the form template however (for a basic formatting change for example), none of the existing topics are updated. The documentation implies that the template is only used when the record is first created - unlike the form which you can add fields to that will be picked up when you next edit the topic.

For example:

I have topics FileDoc0001, FileDoc0002

I then change the template so that the heading reads: "File Doc Info!"

If I create FileDoc0003 - it gets the new heading, but records 0001 and 0002 do not. Is there a way, or a script, to go back and re-apply the template to existing topics as if they were new?

Appreciate any help on this, it's driving me crazy. I'm documenting the programs, files and settings for a complex EDI system and will probably change template layout several times before this is right.

Environment

TWiki version: TWikiRelease04x02x02
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS: Suse 10.2
Web server: Apache
Perl version: 5.8.8
Client OS: Vista
Web Browser: Firefox & IE
Categories: Forms, Skin

-- DerekPrueitt - 12 Oct 2008

Answer

ALERT! 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.

No. The template only affects new topics created based on the template. In fact there is nowhere it is stored which template a topic was based on.

Even a standard topic is based on a template and for sure you do not want 100s of 1000s of topics molested when you update a template. There is no way TWiki can know how to apply a change to a template once a topic has lived its life and been modified many times.

-- KennethLavrsen - 13 Oct 2008

I think I solved this myself. It is ugly but it works.

Using the ability to add arbitrary variables to INCLUDE I created a single EdiFileDisplay topic:

---++ XX EDI Files - %FNAME%

<table width="90%" cellspacing="0" id="table1" cellpadding="4" class="ediTable" rules="all" border="1">
<tr><th colspan="2" align="center">File information for : <b>%FNAME%</b></th></tr>
<tr><td> *File Name:* </td><td> <b> %FNAME% </b></td></tr>
<tr><td> *File Summary:* </td><td> %FBRIEF% </td></tr>
<tr><td> *File Type:* </td><td> %FTYPE% </td></tr>
<tr><td> *Dictionary Link:* </td><td> %FDICT% </td></tr>
</table>
<br />

Note it uses Fxxxx variables where a SEARCH would normally be. In the actual topics themselves, the INCLUDE looks like:

%INCLUDE{"EdiFileDisplay"
  FNAME="%SEARCH{ "^%TOPIC%$" scope="topic" limit="1" regex="on" nosearch="on" nototal="on" format="$formfield(EdiFileName)" }%"
  FBRIEF="%SEARCH{ "^%TOPIC%$" scope="topic" limit="1" regex="on" nosearch="on" nototal="on" format="$formfield(EdiFileBrief)" }%"
  FDESC="%SEARCH{ "^%TOPIC%$" scope="topic" limit="1" regex="on" nosearch="on" nototal="on" format="$formfield(EdiFileDesc)" }%"
  FTYPE="%SEARCH{ "^%TOPIC%$" scope="topic" limit="1" regex="on" nosearch="on" nototal="on" format="$formfield(EdiFileType)" }%"
  FUSEDBY="%SEARCH{ "^%TOPIC%$" scope="topic" limit="1" regex="on" nosearch="on" nototal="on" format="$formfield(EdiFileUsedby)" }%"
  FNOTES="%SEARCH{ "^%TOPIC%$" scope="topic" limit="1" regex="on" nosearch="on" nototal="on" format="$formfield(EdiFileNotes)" }%"
  FDICT="%SEARCH{ "^%TOPIC%$" scope="topic" limit="1" regex="on" nosearch="on" nototal="on" format="$formfield(EdiFileDict)" }%"
}%

I put that same thing in the Template for the form, so that all files look the same. Now I can change the single EdiFileDisplay topic and all the pages based on it pick up the new formatting.

Obviously this isn't going to help me if I add new variables, but my challenge right now was being able to globally format.

I feel like there is probably a better way I could do this using URLPARAM and a single topic that pulls in the data base on URL parameter (the topic to view). But for now, what I have here works.

Not closing yet because I'd still appreciate other's thoughts on better ways to do this. 2 days ago I'd never written even a piece of Wiki formatted text never mind made an app in it.

It actually uses fewer searches than the old version because the topic name (FNAME) is reused. Seems this "hack" would also be a good way to have a front-end page to arbitrarily set variables before including the real topic.

-- DerekPrueitt - 13 Oct 2008

Change status to:
Edit | Attach | Watch | Print version | History: r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r3 - 2008-10-13 - DerekPrueitt
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.