SID-01171: Good method or example to update form fields in Contrib
| Status: |
Answered |
TWiki version: |
4.3.1 |
Perl version: |
5.8.8 |
| Category: |
CategoryAPI |
Server OS: |
AIX 5.3 |
Last update: |
14 years ago |
I'm writing a contrib (batch job) which will read some XML and update or create some form fields in a topic. I'm not sure of the best way to modify the form fields. I can readTopic, getFormName, getField, putKeyed, etc., but I don't seem to have the order right, or if there is a cleaner existing function. If someone could suggest a good existing module out there I can use as a model, I would appreciate it!
--
AaronLWalker - 2011-05-11
Discussion and Answer
Look into the source code of
EditHiddenTablePlugin,
EditTablerowPlugin,
RestPlugin,
WorkflowPlugin,
XpTrackerPlugin.
Example:
my( $topicMeta, $topicText ) = TWiki::Func::readTopic( $web, $topic );
my $field = $topicMeta->get( 'FIELD', 'Title' );
if( $field ) {
$field->{value} = $newTitle;
$topicMeta->putKeyed( 'FIELD', $field );
}
TWiki::Func::saveTopic( $web, $topic, $topicMeta, $topicText );
--
PeterThoeny - 2011-05-12
Aaron, please consider writing a blog post on twiki.org on how TWiki helps your organization. More at
BlogIdeas.
--
PeterThoeny - 2011-05-12
I may. I've thought about it, but it's rather a battle here against... "competing" products, such that I fear I may get myself into trouble. And administering TWiki is completely peripheral to what I do, so time is limited

I'll think about it. Thanks for the help, as always! Hopefully I'll change the status on this in a day or so.
--
AaronLWalker - 2011-05-12
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.