New Foswiki release 2.1.6 is available with important security fixes.
Sourceforge foswiki email lists being discontinued. Subscribe to the new Foswiki announce and discuss lists at MailingLists
This question about Using an extension: Asked

Behavior when creating a new topic

I wanted to set a topic preference which contains a macro when creating a new autoincremented topic. So I put in my form (I use 'save'):
<input type="hidden" name="Set+id_elemento" value="%BA%NOP%SETOPIC%"/>

The problem at first was that the macro was expanded without evaluating the AUTOINC an even if I put the nop, the final value of the preference was "<topic>AUTOINC0000" instead of "<topic>XXXX". So i tried putting another nop inside the nop:
<input type="hidden" name="Set+id_elemento" value="%BA%%NOP%NOP%SETOPIC%"/>

But in the new topic the expaded variable look like it wasn't expanded:

instead of "<topic name>". When I looked at the text file of the topic I found that the nop was present:
%META:PREFERENCE{name="id_elemento" title="id_elemento" type="Set" value="%25BA<nop>SETOPIC%25"}%

So I need to enter to manage the preferences, even if I press cancel, the value is updated without the nop a I get what I wanted. But the thing is that each time I create a topic in that way, I need to enter the preferences for making it work so I can't get a thing between using 1 o 2 nops:
  • 1 nop: all gets expanded before the AUTOINC is evaluated
  • 2 nops: the second nop prevails
I don't know if there is a way to do what I wanted. Although I think the AUTOINC thing is not an elegant solution, it would be best if it were a macro of a plugin that gets expanded before saving or editing so we can use it for multiple purposes.

-- PompetardO - 10 Nov 2011

QuestionForm edit

Subject Using an extension
Extension SetVariablePlugin
Version Foswiki 1.1.3
Status Asked
Related Topics
Topic revision: r1 - 10 Nov 2011, PompetardO - This page was cached on 17 Aug 2018 - 07:55.

The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy