Tags:
create new tag
, view all tags

Question

I've tried various ways with no success. Is it possible to specify the options for an HTML select where part of the option is a TWiki variable? That is:

<form name="new" action="%SCRIPTURLPATH%/edit%SCRIPTSUFFIX%/%WEB%/">
|  *NEW  Topic:* | <select name="topic" size="1"> \
                  %INCLUDE{ActionPlanOptions}%
                   </select> <br /> Note: This must be a TWiki.WikiWord. |
| &nbsp; | <input type="submit" value=" Create "/ > |
<input  type="hidden" name="onlywikiname" value="on" />
<input  type="hidden" name="templatetopic" value="FindingsSummaryAndActionPlanTemplate" />
<input  type="hidden" name="topicparent" value="%TOPIC%" />
<input  type="hidden" name="CreationDate" value="%SERVERTIME{"$day $mon $year"}%" />
<input  type="hidden" name="DocumentOwner" value="%WIKINAME%" />
</form>

The topic ActionPlanOptions is of the following form:

%STARTINCLUDE%<option selected value="">Select...</option> \
<option>%TOPIC%SiteOne</option> \
<option>%TOPIC%SiteTwo</option> \
<option>%TOPIC%SiteThree</option> \
<option>%TOPIC%SiteFour</option> \
<option>%TOPIC%SiteFive</option> \%STOPINCLUDE%

The options, when pulled into the current topic, should then have %TOPIC% expanded to the current TOPIC.


EXAMPLE: The correct result, when pulled into TOPIC ActionPlanQOne should be:

NEW Topic:
Note: This must be a WikiWord.
 

REALITY: Instead, %TOPIC% is rendered in ActionPlanOptions and the resulting form is:

NEW Topic:
Note: This must be a WikiWord.
 

I've tried adding as in

%<nop>TOPIC%
but this simply causes the select list to have %TOPIC% as part of the new topic name.

I want to use an include to make it easy to add new items to the list, very similar to how %WEBLLIST% can create dynamic select lists but I would like the selection to be TOPIC-context sensitive. I've created an example at DynamicHTMLSelectFromInclude just to prove to myself that it is not site (mine) specific.

Environment

TWiki version: TWikiRelease01Feb2003
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS: Unix (solaris)
Web server: Apache/1.3.26 Server at twiki.sps.mot.com Port 80
Perl version: 5.6.0
Client OS: WindowsXPPro
Web Browser: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5) Gecko/20031007

-- SteveRJones - 03 Feb 2004

Answer

Won't %INCLUDINGTOPIC% do the trick? I've modified your sample application accordingly.

-- FranzJosefSilli - 05 Feb 2004

Yes, and now I feel really stupid. I read that and re-read that description but not until now does it make sense. Thanks!

-- SteveRJones - 06 Feb 2004

Topic revision: r4 - 2004-02-07 - FranzJosefSilli
 
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.