Tags:
create new tag
, view all tags

Question

I am using the EditTableRow plugin to have an editable table that can scale to many hundreds of rows. How can I include a twiki variable in the web form template (e.g., in the 'values' column) so that it gets expanded whenever I create a new row to produce a default value that can be different each time?

More detail: One of the fields of my table is an ID that I would like to have autogenerated. I've written a simple plugin %NEXT_ID{topic=... prefix=...}% that will search through a topic for any id's (strings that start with a prefix followed by digits) and returns the next highest unique ID. E.g., if I have:

ID Description
ID0001 foo
ID0002 bar

And then I add a new row to this table via the EditTableRow plugin, I want the ID column to automatically have a new id of ID0003.

In the web form template (as referenced by the EditTableRow plugin's "template" parameter), I create a 'label' type entry where the value is set to %NEXT_ID{topic="Sandbox.MyTopic" prefix="PR"}%. Then when I click on the edit box of my table and add a new row, the table gets updated by adding a new row where the ID field is set to: %NEXT_ID{topic=Sandbox.MyTopic prefix=PR}%. Two things about this:

  • Note that the quotes have disappeared, making this something that extractNameValuePair() will croak on.

  • I want to have this expanded out to be the actual ID that %NEXT_ID% returns, not the TWiki variable itself. I.e., if I add another column, then it will have the same ID as the previous one.

So, I'm looking to solve either:

  • How do I get my %NEXT_ID% plugin to resolve to its actual value when I add a new row to my EditTableRow table?

  • Is there a better way to have a unique monotonically increasing ID created automatically for a field using the EditTableRow plugin?

Thanks in advance for any help!

Cheers,

Martin.

Environment

TWiki version: TWikiRelease04Sep2004
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin, EditTablerowPlugin
Server OS: Fedora Core 2
Web server: Apache 1.3.31
Perl version: 5.8.3
Client OS: Fedora Core 2, Mac OS 10.4
Web Browser: Firefox
Categories: Plugins

-- MartinReddy - 31 Jan 2006

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.

Martin, take a look at ChangeRequest that was created by (I believe) Peter. Although there are corner cases that may cause you to tweak this app I believe the solution is simple and make use of pre-existing plugins. I kicked myself when Peter pointed me toward the sandbox as there are many examples in here that can be applied to many different scenarios.

Have Fun!

-- SteveRJones - 01 Feb 2006

Nothing back so I am closing this as answered.

-- SteveRJones - 28 Feb 2006

 
Topic revision: r3 - 2006-02-28 - SteveRJones
 
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.