I have a class called TaskManager with a property called Reporter that is of a
"List of Users" type. What I am trying to do is assign the current user to the
Reporter property when a new document is created so that the user does not have
to select himself from the user list control, but I would like this field to
also remain as read-only so the user cannot change it to someone else.
Using the following code in the TaskManagerSheet, the property gets populated
on new, however when it is saved it disappears (not saved into the property). I
have narrowed it down to the problem being the 'view' parameter in the
$doc.display() function which makes it readonly, however because of this it is
not being saved. Is there a way to set a value on new but retain a read-only
status
Here is the code that I am using:
#set ($discard = $doc.use('TaskManager.TaskManagerClass'))
#if($doc.isNew())
$doc.set('reporter',$context.user)
#end
: $doc.display('reporter', view)
_______________________________________________
users mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/users