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, see insite:calltemplate instead).

Syntax

Parameters

field (optional)
Indicates the name of the edited field.

assetid (optional)
Indicates the id of the edited asset.
Defaults to the value of the cid variable, i.e. the value returned by ics.GetVar("cid")

assettype (optional)
Indicates the type of the edited asset.
Defaults to the value of the c variable, i.e. the value returned by ics.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 html.

editor (optional)
The name of the editor to use for the attribute.
The only value currently supported is ckeditor, 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 widget
string
a dijit.form.ValidationTextBox widget
date
a dijit.form.DateTextBox widget
float
a dijit.form.NumberTextBox widget
int
a dijit.form.NumberTextBox widget, with the appropriate constraints set
text
a dijit.form.Textarea widget
long
a dijit.form.NumberTextBox widget
currency
a dijit.form.CurrencyTextBox widget
blob
file upload widget, based on HTMLUploader

params (optional)
This specifies, in JSON format, the parameters that should be passed to the underlying Dojo widgets. The following values are currently supported:

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).

index (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 when mode="html", or like string:stream when mode="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 the c and cid 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 by c and cid, 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. a money 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

insite:list

  Home > Contents > Index >

Oracle JSP Tag Reference
Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.