Hi,
Normally, for a computed field, you can easily control both the script and
the custom displayer. The content of the script meta property gets rendered
the same for both view and edit modes, so that`s why asking explicitly for
'view' has no effect on the output.
What you could do instead, is to use the custom displayer and specify a
simplified version that the computed field will be displayed as, for view
mode. This can either be a plain text version or it can be a form input,
but disabled, as you suggested. There`s also a list of available
bindings/variables [1] that you can use, while writing a custom displayer.
Hope this helps,
Eduard
----------
[1]
https://www.xwiki.org/xwiki/bin/view/FAQ/Bindings+available+inside+the+Cust…
On Tue, Dec 6, 2016 at 3:48 PM, Gerritjan Koekkoek <gerritjan(a)cdlsworld.org>
wrote:
We use computed field in a class
We would like that the sheet, that creates a xform for this class,
displays these fields always in a 'disabled' mode (read-only)
Using $doc.display('computedField') currently presents the field Editable
when the user is creating a new object or edits the existing object of class
We tried using $doc.display('computedField','view') but this has no
effect on the computedFields; funny enough $doc.display('normalField',
'view') does put the field in 'view' (read-only) mode.
We would actually prefer that it will just a 'disabled' tag to the form
field
Gerritjan Koekkoek
Vader van Rai Koekkoek (cdls) en voorzitter vereniging CdLS
Visit our website<http://www.cdlsworld.org>
Facebook<https://www.facebook.com/gerritjan.koekkoek>
email<gerritjan(a)cdlsworld.org>