Question
I have a form,
DailyRecordForm, that has a field "Week" of type text, and a field "Date" of type "date". This form is used as the default on
DailyRecordTemplate. I use this template every day to create a page per day.
The Week field in the template has the value %GMTIME{$week}; the Date field has the value %GMTIME{$day $month $ye}.
When I go to edit the template page again, the Date field has been converted to a real date, but the Week field keeps its %GMTIME literal.
If I put the fugly %GMTIME %NOP {$day $month $ye} then when I edit for the second time it becomes %GMTIME{$day $month $ye}(so losing %NOP) and so by the third edit it becomes a real date.
I want the date and week to expand on the pages created per day, but not in the template page.
I've omitted trailing % from this example to simplify this page.
Thanks, Martin
Environment
--
MartinCleaver - 28 Oct 2008
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.
Instead of using the GMTIME function in the values of the form you attach to your template, use GMTIME to pass the value when creating the topic. That is, when creating the topic, in that form you use to create the topic with the attached form, insert something like this
…
<input type="hidden" name="templatetopic" value="DailyRecordTemplate" />
…
<input type="hidden" name="Week" value="%GMTIME{$week}%" />
<input type="hidden" name="Date" value="%GMTIME{$day $month $ye}%" />
…
So your new topic will be initially instantiated with the expanded values.
--
EnriqueCadalso - 04 Nov 2008
Enrique describes a good workaround.
Martin, you'd need
ControlOverVariableExpansion which I believe is implemented in 4.2 but not documented. (Caused by delays due to roadblocks on spec proposal).
--
PeterThoeny - 06 Nov 2008