Tags:
create new tag
, view all tags

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

TWiki version: TWikiRelease04x02x02
TWiki plugins:  
Server OS:  
Web server:  
Perl version:  
Client OS:  
Web Browser:  
Categories: Forms

-- MartinCleaver - 28 Oct 2008

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.

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

 
Change status to:
Topic revision: r3 - 2008-11-06 - PeterThoeny
 
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.