Forms Advanced Field
Overview
An LDP Form provides users with the tools necessary to create questionnaires, surveys, polls, and
other types of forms. Users can choose from six types of elements to insert into a form.
For more information about form elements, visit the Form Elements page.
Each element has the Advanced field attribute. Depending upon when a site was implemented
in OU Campus, these attributes may or may not be contained within a current XSL. Additionally,
any classes defined in CSS may override the settings for attributes such as cols and rows. Every
declaration in the Advanced field must be terminated with a semicolon. For example:
legend=true;addclass=form_legend;
Attributes are always lowercase and in certain cases, more than one attribute can be included in
the field. For datasets, additional dataset options are defined in the datasets.xsl file, and that is also
where the names can be found of the current ones and new sets can be added. For addclass, the
class has to be already defined in CSS.
If a Required checkbox is available for a form element it will need to be selected via the interface. If
a "required" checkbox is not available, it can be specified in the Advanced field with the following:
required=true;
Advanced Field Reference Table
Attribute Name
Syntax Example
Description
legend
legend=true;
In a single-line text field, the text
entered into the Default field
appears as traditional content
rather than a form field. This can
be used, for example, to provide
an additional instruction or an
example to the form submitter.
HTML Output Example
<div id="About" class="controlgroup">About</div>
addclass
addclass=required;
Adds a class to the <span> that
encapsulates the element. The
class can be anything that has
been defined in CSS. In this
example, the “required” class
adds a red asterisk.
HTML Output Example
<span class="required">
…
OU Campus
Forms Advanced Field
Page 1 of 17
Attribute Name
Syntax Example
Description
</span>
fieldset_start
fieldset_start=true;
Defines the opening tag for a
<fieldset> tag within the form.
This is used in conjunction with
fieldset_end to set off a group of
elements. In the examples that
follow, it is indicated with a blue
horizontal rule. It can also be
used with fieldset_label to define
a label for the group.
HTML Output Example
<fieldset>
fieldset_end
fieldset_end=true;
Defines the closing tag for
a fieldset and is used in
conjunction with fieldset_start
and fieldset_label. In the
examples that follow, it is
indicated with a blue horizontal
rule.
HTML Output Example:
</fieldset>
fieldset_label
fieldset_label=About;
Defines the label of the fieldset.
For example, if the group should
be labeled “About” then that
can be defined here. It can be
entered without quotes and can
include spaces.
HTML Output Example:
<legend>
Examples of Multi-Line Fields</
legend>
size
size=10;
Adds a size attribute to a singleline text field within the form. The
size attribute is used to specify
the viewable size of the field
defined in characters. This does
not determine the number of
allowed input characters.
HTML Output Example:
OU Campus
Forms Advanced Field
Page 2 of 17
Attribute Name
Syntax Example
Description
<input type="text"
name="SizeAttribute"
id="id_SizeAttribute" size="3">
cols
cols=10;
Adds the cols attribute with the
specified value to a multi-line text
field form element. For HTML
output this attribute specifies the
visible width in average character
widths. This does not determine
the number of allowed input
characters.
HTML Output Example:
<textarea name="Description"
cols="10" rows="10"></textarea>
rows
rows=10;
Adds a rows attribute with the
specified value to a multi-line
text field. For HTML output
this attribute specifies the
number of visible text lines
for a textarea. This does not
determine the number of allowed
input characters.
HTML Output Example:
<textarea name="Description"
cols="10" rows="10"></textarea>
dataset
dataset=state;
Adds a predefined dataset to a
radio button, checkbox, singleselect, or multi-select element.
This is useful for data that are
frequently used, but tedious to
type. For example, the “state”
dataset includes all 50 United
States so that they may be
used in a selector element.
Preconfigured datasets include:
•
•
•
•
•
•
•
OU Campus
Forms Advanced Field
state
state_ab
country
year
month
alphabet
numbers
Page 3 of 17
Attribute Name
Syntax Example
Description
form_classes
form_classes=well well-raised;
Adds one or more classes to the
specified form node. See the
following examples:
To add class="form-horizontal"
use form_classes=formhorizontal
To add class="btn btn-mini" use
reset_btn_classes=btn btn-mini;
To add a class to the
submit button, use
submit_btn_classes=class name;
Legend Attribute
The proper syntax for this is legend=true; and it can be used to display additional information
or instructions for users who are completing the form. A legend is created within a SingleLine Text Field element. The Default Text is displayed and no input element is available. The
fieldset_start=true; and fieldset_label might also be used to create a section or grouping of several
elements within a form.
OU Campus
Forms Advanced Field
Page 4 of 17
Fieldset Attribute
A fieldset typically includes three items that are used to group a set of form elements:
• fieldset_start=true — Defines the beginning of the fieldset
• fieldset_label="Label for Fieldset" — Defines the label of the fieldset
• fieldset_end=true — Defines the end of the fieldset
In this example, a single-line text field element is used to start a fieldset and to give it the label of
About.
OU Campus
Forms Advanced Field
Page 5 of 17
Label Attribute
In this example, size of a multi-line text field is defined with the cols and rows attribute and is also
used to end the fieldset, which is indicated by the horizontal rule.
OU Campus
Forms Advanced Field
Page 6 of 17
Visual Representations
OU Campus
Forms Advanced Field
Page 7 of 17
Size Attribute
The size attribute specifies the viewable size (in characters) of a single-line text field within a form.
This does not limit the number of allowed input characters.
Cols and Rows Attributes
Columns and rows can be used together or singularly to define the visible starting size of the text
area for a multi-line text field. Users can input more text than the defined area as by default scroll
bars and field resizers are included. The following example creates a multi-line text area of 40
characters by 15 lines.
OU Campus
Forms Advanced Field
Page 8 of 17
Here’s an example of the HTML output. It creates the <textarea> element with the cols defined as
40 and the rows attribute as 15.
OU Campus
Forms Advanced Field
Page 9 of 17
Addclass Attribute
The addclass attribute adds a class to the label of an element. The class can be anything that has
been defined in CSS. In this example, the “required” class adds a red asterisk. If an institution has
not had its own CSS implemented, by default the LDP form asset uses an included CSS file. This
is typically located at: _resources/css/ouforms-bootstrap.css. This example shows the use of the
addclass=required; attribute with a drop-down list using the country dataset.
The definition for the “required” class was added to the CSS file as follows:
.required > label:first-child:before {
content : "* ";
color
: red;
}
Datasets Attribute
When defining a dataset in the Advanced field for an element, the individual items do not have
to be additionally defined as the data is pulled from the XSL. For example, when defining a radio
button element without the use of a dataset, the items are defined by clicking the New Radio Button
and manually typing the text in the field. This holds true also for the checkbox, multi-select, and
drop-down list items. No further definition is required with the form element creation when using a
datase as it is defined in an XSL.
Radio Button Form Element Using: dataset=year;
The following example illustrates the use of a dataset in the Advanced field that produces
a predefined listing of years (dataset=year;). The specific years are defined in the XSL
(datasets.xsl). This example shows dataset=year; being used with a radio button element; the form
user will be able to choose one and only one year.
OU Campus
Forms Advanced Field
Page 10 of 17
Visual Representation
Dataset Definition from the XSL
<xsl:when test="ou:get-adv($adv,'dataset') = 'year'">
2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020</
xsl:when>
OU Campus
Forms Advanced Field
Page 11 of 17
Checkbox Form Element Using: dataset=month;
The following example illustrates the use of a dataset in the Advanced field that produces
a predefined listing of months (dataset=month;). The specific months are defined in the XSL
(datasets.xsl). The resulting listing uses the checkbox element in which the user can select none,
one, or many.
Dataset Definition from the XSL
<xsl:when test="ou:get-adv($adv,'dataset') = 'month'">Jan, Feb, Mar, Apr,
May, Jun, Jul, Aug, Sep, Oct, Nov, Dec</xsl:when>
Drop-Down Menu Using: dataset=country;
The following example illustrates the use of a dataset in the Advanced field that produces a listing
of countries (dataset=country;). The specific countries are defined in the XSL (datasets.xsl). The
resulting listing uses the drop-down menu element. In this example the use of addclass specifies
the class named “required” which adds a red asterisk to the label. In the Advanced field, enter:
dataset=country;addclass=required;
OU Campus
Forms Advanced Field
Page 12 of 17
OU Campus
Forms Advanced Field
Page 13 of 17
Dataset Definition from the XSL
<xsl:when test="ou:get-adv($adv,'dataset') =
'country'">Afghanistan,Albania,Algeria,Andorra,Angola,Antigua and
Barbuda,Argentina,Armenia,Australia,Austria,Azerbaijan,Bahamas,Bahrain,Banglades
and Herzegovina,Botswana,Brazil,Brunei,Bulgaria,Burkina
Faso,Burma,Burundi,Cambodia,Cameroon,Canada,Cape Verde,Central African
Republic,Chad,Chile,China,Colombia,Comoros,Congo (Brazzaville),Congo
(Kinshasa),Costa Rica,Cote d"Ivoire,Croatia,Cuba,Cyprus,Czech
Republic,Denmark,Djibouti,Dominica,Dominican Republic,East
Timor,Ecuador,Egypt,El Salvador,Equatorial
Guinea,Eritrea,Estonia,Ethiopia,Fiji,Finland,France,Gabon,Gambia,Georgia,Germany
Bissau,Guyana,Haiti,Honduras,Hungary,Iceland,India,Indonesia,Iran,Iraq,Ireland,I
Korea,South
Korea,Kuwait,Kyrgyzstan,Laos,Latvia,Lebanon,Lesotho,Liberia,Libya,Liechtenstein,
Islands,Mauritania,Mauritius,Mexico,Federated States of
Micronesia,Moldova,Monaco,Mongolia,Montenegro,Morocco,Mozambique,Namibia,Nauru,N
Zealand,Nicaragua,Niger,Nigeria,Norway,Oman,Pakistan,Palau,Panama,Papua
New
Guinea,Paraguay,Peru,Philippines,Poland,Portugal,Qatar,Romania,Russia,Rwanda,Sai
Kitts & Nevis,Saint Lucia,Saint Vincent and the
Grenadines,Samoa,San Marino,Sao Tome and Principe,Saudi
Arabia,Senegal,Serbia,Seychelles,Sierra
Leone,Singapore,Slovakia,Slovenia,Solomon Islands,Somalia,South
Africa,Spain,Sri
Lanka,Sudan,Suriname,Swaziland,Sweden,Switzerland,Syria,Tajikistan,Tanzania,Thai
& Tobago,Tunisia,Turkey,Turkmenistan,Tuvalu,Uganda,Ukraine,United
Arab Emirates,United Kingdom,United
States,Uruguay,Uzbekistan,Vanuatu,Venezuela,Vietnam,Yemen,Zambia,Zimbabwe</
xsl:when>
Multi-Select Form Element Using: dataset=state;
The following example illustrates the use of a dataset in the Advanced field that produces a listing
of states of the United States of America (dataset=state;). The specific states are defined in the
XSL (datasets.xsl). The multi-select allows users to use CTRL + mouse click to select one or more
items from a list.
OU Campus
Forms Advanced Field
Page 14 of 17
Dataset Definition from the XSL
<xsl:when test="ou:get-adv($adv,'dataset') =
'state'">Alabama,Alaska,Arizona,Arkansas,California,Colorado,Connecticut,Delawar
Hampshire,New Jersey,New Mexico,New York,North Carolina,North
Dakota,Ohio,Oklahoma,Oregon,Pennsylvania,Rhode Island,South
Carolina,South
Dakota,Tennessee,Texas,Utah,Vermont,Virginia,Washington,West
Virginia,Wisconsin,Wyoming</xsl:when>
Drop-Down Selection List Using: dataset=state_ab;
The following example shows a listing of state abbreviations for the states of the United States of
America.
OU Campus
Forms Advanced Field
Page 15 of 17
Dataset Definitions from the XSL
<xsl:when test="ou:get-adv($adv,'dataset') =
'state_ab'">AK,AL,AR,AZ,CA,CO,CT,DC,DE,FL,GA,HI,IA,ID,IL,IN,KS,KY,LA,MA,MD,ME,MI
SD,TN,TX,UT,VA,VT,WA,WI,WV,WY</xsl:when>
OU Campus
Forms Advanced Field
Page 16 of 17
Adding a New Dataset to the XSL
A conditional defined in the XSL creates the dataset based on the use of the Advanced field in
the form element and the dataset named within. In the XSL, the name of the dataset to use gets
passed to the XSL with $adv. The XSL does a choose test to return the correct dataset.
Another dataset can be added to the existing XSL as another when condition. The when condition
is set off with double quotes, so the dataset name is included within single quotes. Each item in
the dataset should be separated by a comma. Spaces can be used within an item, but character
entities should not. For example, instead of an ampersand (&) the HTML entity should be used:
& and instead of a quote mark ('), the " entity should be used.
1. Navigate to the datasets.xsl file (typically located in _resources/xsl/).
2. Add the dataset as another test condition. For example to add a dataset called "flavor" that
consists of Ben & Jerry's ice cream flavors, use the following code as another test condition within
the choose statement:
<xsl:when test="ou:get-adv($adv,'dataset') = 'flavor'">Americone
Dream,Cannoli,Cheesecake Brownie,Chocolate Therapy,Chocolate Fudge
Brownie, Cinnamon Buns</xsl:when>
3. Save the XSL. It does not need to be published.
4. Add a new element to the form asset. A defined dataset can be used with the following form
elements:
•
•
•
•
Radio Buttons
Checkboxes
Drop-Down
Multi-Selection
5. In the Advanced field for the element include: dataset=flavor;
6. Save and republish the asset. Republishing an asset republishes any checked-in pages
subscribed to that asset.
7. When the form is inserted on page, the result is similar to the following image:
OU Campus
Forms Advanced Field
Page 17 of 17
© Copyright 2025 Paperzz