<x-subst type="WidgetType">
XHTML placeholder for the USP widget and field data that will be generated in the HTML sent to the browser.
<x-subst {type="
WidgetType"
} name="
Field.Entity.Model{.OccurrenceNumber}"
{x-id="
1"
|"
0"
} {x-for="
1"
|"
0
"
} {width=
Width} {offset=
Offset} {OtherAttributes}>
InitialHTMLValue</x-subst>
Attributes
- type—type of USP widget;
for valid values, see
Field Types. If omitted,
type="value"
is assumed. - name—fully-qualified and capitalized Uniface field name. In the generated XHTML, the associated occurrence number, if applicable, is appended to this value. This which allows Uniface to set the current occurrence when a widget is selected.
- x-id—placeholder for a
generated XHTML
id
attribute. The value determines whether webgen generates theid
attribute:1
= generate,0
= do not generate. For more information, see x-id. - x-for—placeholder for a
generated XHTML
for
attribute. Applicable only fortype="label"
andtype="radio"
. The value determines whether webgen generates thefor
attribute:1
= generate,0
= do not generate. For more information, see x-for. - width—required width in characters for displaying the field. If specified, Width should be greater than zero.
- offset—for
type="radio"
, the number of spaces from the beginning of the line where a radio group appears. If specified, Offset should be greater than or equal to zero. - OtherAttributes—list of other XHTML attributes.
- InitialHTMLValue—initial XHTML representation of the field.
Field Types
Type | Corresponding USP Widget |
---|---|
checkbox
|
Checkbox |
fileupload
|
FileUpload |
html
|
Raw HTML |
image
|
|
hyperlink
|
|
radio
|
|
select
|
If
Size=1 :
MenuIf
Size> |
button
|
|
text
|
Text |
textarea
|
|
value
|
|
label
|
A label |
Description
When you copy or insert Uniface objects into static server pages, Uniface generates <x-subst> elements for all selected fields. Each <x-subst> element contains a field substitute reflecting the initial value of the Uniface field.
When webgen encounters this tag, it tries to perform a field substitution:
- If the <x-subst> syntax is incorrect, no output is generated. This affects the value of $status.
- If the <x-subst>
element contains more than one instance of the same attribute, only one instance is chosen by
Uniface; you cannot predict which instance is used. In the following example, Uniface can
substitute either F1 or F2:
<x-subst type="text" name=F1 name=F2>
- Except for
type
=
value
, if the field specified by the name attribute has data type Image, the substitute is omitted.
x-id
The x-id attribute is used to
determine whether webgen generates an id
attribute for the
field, based on the field's name.
The default value is determined by the
$WEBGEN_X_ID_DEFAULT setting in the application's assignment file. If the
setting is not present, the default value is 0
, so webgen does
generate the id
attribute.
When webgen encounters a
<xsubst type="FieldType">
definition, it applies the
following rules when generating an id
attribute:
- If an
id
attribute is specified in OtherAttributes, it takes precedence over x-id. webgen will use this value for theid
rather than generating its own ID based on the field name. - If x-id is specified in the USP layout, it overrides the default value of x-id.
- If x-id is omitted from the USP layout, the default value specified by the $WEBGEN_X_ID_DEFAULT is used.
- If $WEBGEN_X_ID_DEFAULT is
not defined in the application assignment file, the
id
attribute is not generated. - If
x-id
="
0
"
, noid
is generated. - If
x-id
="
1
"
, anid
attribute is generated that is based on the value of the name attribute.
The generated ID will have the same value as the
name attribute, optionally extended by the server page instance name. For
radio groups, each ValRep pair will result in an element with its own ID that starts with a
sequence number. The format of the generated id
attribute is thus:
id="
{E
SequenceNumber.
}FieldName.
EntityName.
ModelName{.
OccurrenceNumber}{.
InstanceName}"
If you want the id
to include the
USP instance name as suffix to the ID, set the assignment setting
$WEBGEN_X_ID_INSNAME=true
.
For more information, see Customizing the XHTML Generated for USPs.
x-for
The x-for attribute is used
to determine whether webgen generates a for
attribute for an
associated label, based on its name attribute of its associated field.
The default value is determined by the
$WEBGEN_X_FOR_DEFAULT setting in the application's assignment file. If the
setting is not present, the default value is 0
, so webgen does
generate the for
attribute.
When webgen encounters an
<x-subst> definition for a label or radio group, it applies the following
rules when generating a for
attribute:
- If a
for
attribute is specified in OtherAttributes, it takes precedence over x-for. webgen will use this value for thefor
rather than generating its own for attribute. - If x-for is specified in the USP layout, it overrides the default value of x-for.
- If x-for is omitted from the USP layout, the default value specified by the $WEBGEN_X_FOR_DEFAULT is used.
- If $WEBGEN_X_FOR_DEFAULT is
not defined in the application assignment file, the
for
attribute is not generated. - If
x-for
="
0
"
, thefor
attribute is not generated. - If
x-for
="
1
"
, a label element with afor
attribute is generated.
The value of the generated for
attribute is the same as id
attribute of the attached field (for labels) or the
radio button (for radio groups).
For more information, see RadioButton.
Generated ID
Given a static server page called MYUSP, if the
$WEBGEN_X_ID_INSNAME setting is true
, the following
<x-subst> definition:
<x-subst type="text" x-id="1" name="NAME.ENTITYA.MODELA"> /* … {some content here}*/ </x-subst>
could result in the following generated XHTML:
<input id="NAME.ENTITYA.MODELA.1.MYUSP_1" type="text" name="NAME.ENTITYA.MODELA.1" value=""/>