Fixed value can be set by document template which is provided to create
in new Class creation wizard. (Open template document in object editor
mode and enter necessary values).
Dynamic value can be set using document sheet
http://extensions.xwiki.org/xwiki/bin/view/Extension/Sheet+Module
with following Velocity code:
{{velocity}}
#if($doc.isNew())
#set($obj=$doc.getObject('Space.YourObjectClass'))
$obj.set('property','value))
#end
More at
http://platform.xwiki.org/xwiki/bin/view/DevGuide/APIGuide
Valdis
Hi,
I have a document where the user set the name of a document in a textfield
to create a new document as described in the FAQ tutorial.
How is it possible to set a property of the document's object
programmatically? In my case I have a property "id_project" of my class
"project". I want to set the value (an automatically generated id value) of
this property in the new document right after creating it, without user
interaction. It should save the id value with the other values the user
defines before saving the document for the first time.
Thanks a lot!
--
View this message in context:
http://xwiki.475771.n2.nabble.com/How-to-set-a-properties-value-on-a-newly-…
Sent from the XWiki- Dev mailing list archive at
Nabble.com.
_______________________________________________
devs mailing list
devs(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/devs