Home > Contents > Index >
Template Tags TOC | Alpha TOC | Tag Family TOC | Purpose TOC | Annotated TOC | Index
insite:edit
Makes an asset field editable in web mode. All data types are supported, except asset reference fields
(to enable in-context editing for asset reference fields, seeinsite:calltemplate
instead).Syntax
<insite:edit [field="edited asset field name"] [assetid="edited asset id"] [assettype="edited asset type"] [mode="text|html"] [editor="type of editor"] [params="editor parameters"] [value="field value"] [index="index of edited value"] [variable="variable name"] [list="list name"] [column="column name"] [ssvariable="session variable name"] [property="property name"] />Parameters
field (optional)
- Indicates the name of the edited field.
assetid (optional)
- Indicates the id of the edited asset.
Defaults to the value of thecid
variable, i.e. the value returned byics.GetVar("cid")
assettype (optional)
- Indicates the type of the edited asset.
Defaults to the value of thec
variable, i.e. the value returned byics.GetVar("c")
mode (optional)
- For text values, indicates whether special characters should be encoded to their corresponding html numerical code. Valid values are:
Defaults to
text
: <, >, &, < space >, " and ' are encoded to their html numerical code, i.e.<
etc.html
: all characters are streamed as-ishtml
.editor (optional)
- The name of the editor to use for the attribute.
The only value currently supported isckeditor
, which specify that the CKeditor rich text editor should be used instead of the default widget
The default editing widget depends on the data type of the edited field, as summarized in the following table:
Field data type Editing widgetstring
adijit.form.ValidationTextBox
widgetdate
adijit.form.DateTextBox
widgetfloat
adijit.form.NumberTextBox
widgetint
adijit.form.NumberTextBox
widget, with the appropriate constraints settext
adijit.form.Textarea
widgetlong
adijit.form.NumberTextBox
widgetcurrency
adijit.form.CurrencyTextBox
widgetblob
file upload widget, based on SWFUploadparams (optional)
- This specifies, in JSON format, the parameters that should be passed to the underlying Dojo widgets. The following values are currently supported:
noValueIndicator
: text to be displayed when the field is empty- for CKEditor only:
width
: specifies the width of the CKEditor instance. This can be an integer, for pixel sizes, or any CSS-defined unit.height
: specifies the height of the CKEditor instance. This can be an integer, for pixel sizes, or any CSS-defined unit (except percents)toolbar
: specifies a toolbar name to useresize
: specifies whether the resize handle should be visible or notcustomConfig
: specifies an alternate CKEditor configuration file- any field supported by the dojo widgets. For example:
width
: for text fields, specifies the width of the editing widget (by default, it occupies the available width)constraints
: for text, date or number fields, specifies additional constraints defining valid values.regExp
: regular expression to be used to validate user input.invalidMessage
: tooltip displayed by the editing widget when an invalid value is providedSee examples below or The Dojo Toolkit for more details.
value (optional)
- Indicates the current field value.
The current field value can also be specified using one of the following attribute combinations:(the last two variants are rarely used in practice).
variable
: designates a variable containing the current field valuelist
/column
: designates a list and column containing the current field value.ssvariable
: designates a session variable containing the current field valueproperty
: designates a property containing the current field valueindex (optional)
- For multivalued fields only: indicates the 1-based index of the current edited value.
Description
This tag allows content contributors to edit assets using the web mode UI. When viewed outside of the web mode UI, this tag behaves exactly like
render:stream
whenmode="html"
, or likestring:stream
whenmode="text"
.For more information about editing assets in web mode, see the Sites Developer's Guide.
Example 1
The following example enables in-context editing the
headline
of the asset determined by thec
andcid
Sites variables:<%-- - The code sample assumes the current value of the headline attribute to be available - in a list called "article:headline" with a single column called "value", such as a list - returned by the <assetset:getattributevalues /> tag --%> <h1> <insite:edit field="headline" list="article:headline" column="value" /> </h1>Example 2
This example enables in-context editing of the
body
field of the asset determined byc
andcid
, using CKEditor with specific parameters:<%-- - The code sample assumes the current value of the body attribute to be available - in a variable called "articleBody" --%> <h1> <insite:edit field="body" variable="articleBody" editor="ckeditor" params="{noValueIndicator: '[ Enter body here ]', width: '100%'}" /> </h1>Example 3
The width of text fields can also be controlled using the
width
parameter as follows:<h1> <insite:edit field="headline" list="article:headline" column="value" params="{width: '300px'}" /> </h1>Example 4
In the following example, a
price
attribute (e.g. amoney
attribute) is constrained to the 0-100 range, and is required to have 2 decimals (e.g. 10.99):<%-- - The code sample assumes the current value of the price attribute to be available - in a list called "product:price" with a single column called "value", such as a list - returned by the <assetset:getattributevalues /> tag --%> <insite:edit field="price" list="product:price" column="value" params="{constraints: {fractional: true, max: 100.00}, invalidMessage: 'Price must include cents'}" />For more details on dojo constraints, see the following dojo documentation on dates and numbers.For more information about editing assets in web mode, see "Coding Templates for In-Context Content Editing" in the Sites Developer's Guide.
See Also
Home > Contents > Index > Oracle JSP Tag Reference
Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.