Tags:
create new tag
, view all tags

Question

Hi,

I have from which creates a new topic lbased on the user input:

<form action="%SCRIPTURLPATH%/edit%SCRIPTSUFFIX%/%WEB%/" > 
*Create a new Test Case:* &nbsp; (Get a TWiki.TWikiRegistration, Test Case name in TWiki.WikiWord) <br> 
<input type="text"   name="topic"         size="32" /> 
<input type="hidden" name="onlywikiname"  value="on" /> 
<input type="hidden" name="topicparent"   value="TestCaseRoot" /> 
<input type="hidden" name="templatetopic" value="TestCaseHeaderTemplate" />
<input type="hidden" name="formtemplate"  value="TestCaseForm" />
<input type="submit"  class="twikiSubmit"     value="Create Test Case..." /> 
</form>  

The TestCaseHeaderTemplate contains a form as well which allows the user to create another topic. This time I use the SERVERTIME variable to create a unique topic name automatically. i.e.

<form action="%SCRIPTURLPATH%/edit%SCRIPTSUFFIX%/%WEB%/" target="_self"> 
<input type="hidden" name="topic" value="%INCLUDINGTOPIC%%SERVERTIME{$yearx$mox$dayx$hour$min$sec}%" /> 
<input type="hidden" name="onlywikiname"      value="on" /> 
...
</form>
The problem is that whenever I create a new test case the SERVERTIME variable in the created topic is interpreted and the name is fixed. i.e. when I view the created test case in edit mode the form looks like this:
<form action="%SCRIPTURLPATH%/edit%SCRIPTSUFFIX%/%WEB%/" target="_self"> 
<input type="hidden" name="topic" value="%INCLUDINGTOPIC%2007x06x12x113609" /> 
<input type="hidden" name="onlywikiname"      value="on" /> 
...

How can I avoid that the SERVERTIME variable is interpreted.

Note that this used to work before we moved up to 4.1

Environment

TWiki version: TWikiRelease04x01x01
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS: LInux Red hat
Web server: Apache
Perl version: 5.8
Client OS: Win XP
Web Browser: IE6, Opera, Mozilla
Categories: Forms

-- KaiMoorfeld - 12 Jun 2007

Answer

ALERT! If you answer a question - or have a question you asked answered by someone - please remember to edit the page and set the status to answered. The status is in a drop-down list below the edit box.

Argh, it looks like there was a small spec change in TWiki 4.0 frown

Workaround: Escape the SERVERTIME variable with a NOP variable, such as %SER%NOP%VERTIME{...}%. This looks kind of ugly, but the embedded %NOP% gets removed at topic instantiation time.

Other alternative: Use consecutive numbers instead of date: value="%INCLUDINGTOPIC%AUTOINC00001". See TWikiTemplates.

-- PeterThoeny - 12 Jun 2007

Thanks, I went with the excape option which works fine.

-- KaiMoorfeld - 13 Jun 2007

 
Change status to:
Topic revision: r3 - 2007-06-13 - KaiMoorfeld
 
Twitter Delicious Facebook Digg Google Bookmarks E-mail LinkedIn Reddit StumbleUpon    
  • Download TWiki
TWiki logo Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2012 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.