Tags:
create new tag
view all tags

SID-00403: Expanding %TO%NOP%PIC% in a Form on a Template

Status: Answered Answered TWiki version: 4.3.1 Perl version:
Category: CategoryForms Server OS: Last update: 16 years ago

I have a template with a form attached. One of the fields in the form is a simple ‘text’ field containing this link:

[[%SCRIPTURL%/view/%WEB%/DocSignOff?itemforsignoff=%TOP%NOP%IC%][Request SignOff]]
(For the purposes of testing, I have put the same text in the body of the template, ie. outside the form.) The idea is that by following the link from the form, the user navigates to the page DocSignOff passing the current wiki page (%TOPIC%) as a parameter. If I don’t put the %NOP% in the middle of %TOPIC% then it is expanded there and then and I get the template name as the parameter; I need to defer expansion until I have a real page based on the template. If I create a page based on this template, then all the variables in the above text are expanded except the %TOPIC%, which is fine. Something like this:
http://twiki.org/cgi-bin/view/TWiki/DocSignOff?itemforsignoff=%TOPIC%
My problem is this. If this string is embedded in the form then it does not resolve the %TOPIC%; the “itemsforsignoff” parameter is simply “%TOPIC%” rather than the wiki page name that I want. However if this very same text is outside the form, elsewhere on the same page, then it does expand the %TOPIC% into the wiki page name. I have browsed the wiki documentation, particularly http://twiki.org/cgi-bin/view/TWiki/TWikiTemplates#Variable_Expansion, and can find no mention of different behaviour of variable expansion depending whether the variable is in a form or not. Is this a bug or a feature? How can I get the link in the form to work properly?

thanks

-- GrahamWatson - 2009-07-08

Discussion and Answer

Variable expansion behavior might be different in form fields. In your case try %BASETOPIC% to point to the base topic where the form is located.

-- PeterThoeny - 2009-07-08

thanks for getting back to me, Peter. %BASETOPIC% doesn't seem different to %TOPIC% in this circumstance but thanks for pointing me to it. I cannot explain why, but now the %TOPIC% embedded in the form (in the string shown above, which expands to http://twiki.org/cgi-bin/view/TWiki/DocSignOff?itemforsignoff=%TOPIC%) does now seem to expand when I want it. I would swear that when I raised this question it didn't! So i think we can mark this closed for now.

-- GrahamWatson - 2009-07-10

      Change status to:
ALERT! If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.
SupportForm
Status Answered
Title Expanding %TO%NOP%PIC% in a Form on a Template
SupportCategory CategoryForms
TWiki version 4.3.1
Server OS

Web server

Perl version

Edit | Attach | Watch | Print version | History: r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r3 - 2009-07-10 - GrahamWatson
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.