How can I hide or show a button (or
any other control) depending on whether the current XPage is in edit or
read only mode?
To determine if the current page is
in edit mode, use document.isEditable()
is the name of the object representing your data source (usually
document1 by default).
To hide a control based on this state,
compute its rendered
property with document.isEditable()
Generally speaking, there are two properties
you can use to hide controls:
- the "rendered" attribute corresponds
to the "Visible" UI option in the properties panel:
If this property is set to FALSE, the control and its state will be maintained
on the server, but it will not be rendered to the browser.
- the "loaded" attribute can
only be set/computed in the "All Properties" panel:
If this property is set to FALSE, the server will completely ignore the
control, not maintain its server-side state and not render it to the browser.