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:* (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
--
KaiMoorfeld - 12 Jun 2007
Answer
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
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