Tags:
create new tag
, view all tags

Question

I have a form definition which uses a page name as the name of a checkbox field, as:

| [[Node Omits]] | checkbox | 5 | | What Nodes should be omitted? |   |

I'd like the Node Omits page to be dynamically-created, so that the set of checkboxes is generated on the fly. I have some code which generates a plausible table, when called as follows:

  .../NodeOmits?name=A View Name

The code looks like:

%~~ SEARCH{
~~~   topic="N_*"
~~~   search="META:FIELD.*name=.ViewNames.*value=.*%URLPARAM{"name"}%" 
~~~   type="regex" nonoise="on"
~~~   format="| $formfield(NodeName) |"
~~~ }%

Sadly, I can't figure out how I would call this (or even whether I can). Help?

Environment

TWiki version: unspecified
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS:  
Web server:  
Perl version:  
Client OS:  
Web Browser:  
Categories:  

-- RichMorin - 07 Sep 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.

From memory, the change I made back in Cairo days to enable dynamically generated Form field definitions never made it into TWiki.

At this point, TWiki does not evaluate TML before parsing the Forms definitions - so iirc its not possible. If things have not change too much, then it only required the addition of one line to the meta definition parsing code, near the beginning - but it's been a while - Somehow I think there is a feature request for this in Codev.

-- SvenDowideit - 07 Sep 2008

TWikiForms allow dynamic definition of field values: "Field values can also be generated through a FormattedSearch, which must yield a suitable table as the result."

You are using a non-standard SEARCH with %~~; not sure if the TWiki core understands this plugin specific syntax. Probably safer to stick to the documented VarSEARCH format.

-- PeterThoeny - 08 Sep 2008

Just for the records, GluePlugin syntax is not needed when working with TWiki 4.0 and later, as it recognizes multiline vars. If you remove the ~ from your search, it should work.

You can use the search (but you'll need to put it as a single line) to define the values for a Form field (see TWikiForms), BUT the search is evaluated regardless of the context. This means that the search cannot be parametrized.

-- RafaelAlvarez - 08 Sep 2008

Rich wants different instances of the form to display different values in the (checkbox) field.

I understand the ideas suggested for dynamically creating the set of values, but I'm not at all sure that this is something that could be triggered by data on an individual page that contains a form.

That is, is there any way to have three pages, PageA, PageB, PageC, that all use the SAME form, and yet, the form data differs on the three pages? That's a subtly different problem.

From RafaelAlvarez's comment, it appears that this may be impossible...

-- VickiBrown - 08 Sep 2008

By way of context, I'm trying to let the user "omit" certain "node" pages from the diagram I'm generating for a "view". Currently, I can only offer a list of all possible node pages, but I'd like to offer only the list of nodes that explicitly mention this view.

-- RichMorin - 08 Sep 2008

You could create three different TWikiForms that have a checkbox field that differs, but otherwise with identical fields. That way you can query the set of pages of all three forms, and still distinguish with checkboxes.

Closing after more than 30 days. Please reopen with more details if needed...

-- PeterThoeny - 06 Nov 2008

 
Change status to:
Topic revision: r7 - 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.