You are here: Foswiki>Tasks Web>Item10477 (16 Mar 2011, GeorgeClark)Edit Attach

Item10477: no way to create a meta object, attach a dataform and set field values programmatically

pencil
Priority: Enhancement
Current State: Confirmed
Released In: n/a
Target Release: n/a
Applies To: Engine
Component: DataForms, FoswikiMeta, CodeRefactoring
Branches:
Reported By: MichaelDaum
Waiting For:
Last Change By: GeorgeClark
It came as a surprise that there's no way to do this easily:

(pseudo code)
   my $topicObj = new Foswiki::Meta($session, $web, "NewTopic", $textWithoutMeta); 
   $topicObj->addDataForm($web, "SomeForm"); # we've got $topicObj->putKeyed('FORM', "$web.SomeForm") ... maybe that's enuf, but still rather low level
   $topicObject->putFormValues(
      FieldName1 => $value1,
      FieldName2 => $value2,
   );

The bits to do that are spread over different places:

  • Foswiki::UI::Save holds the code to establish a DataForm within the Meta object
  • Foswiki::Form::FieldDefinition holds the code to populate a DataForm with values taken from a $query.

The rest of the code assumes a DataForm is already attached to a topicObj. Creating one from scratch is not possible as is now.

-- MichaelDaum - 12 Mar 2011

 

ItemTemplate edit

Summary no way to create a meta object, attach a dataform and set field values programmatically
ReportedBy MichaelDaum
Codebase
SVN Range
AppliesTo Engine
Component DataForms, FoswikiMeta, CodeRefactoring
Priority Enhancement
CurrentState Confirmed
WaitingFor
Checkins
TargetRelease n/a
ReleasedIn n/a
Topic revision: r2 - 16 Mar 2011, GeorgeClark
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy