The format for generating field names in HTML appears to have changed in 7.2.05 in the HTML source (addition of ".1." to field name values). This causes problems when accessing fields from Javascript.
Why does this behavior occur in UV7.2.05?
In Uniface V7.2.04, multiple occurrence behavior was handled in HTML by the
<X-ITERATE> tag, which has been replace in Uniface V7.2.05 by the <X-OCCURRENCE>
tag. Since the <X-OCCURRENCE> tag is generated during HTS file creation
for all entities, whether they are multi-occurrence entities or single occurrence
entities, the field names are furnished with an additional occurrence number
(FIELD.ENTITY.MODEL.1.).
While in Uniface V7.2.04, a single occurrence entity field name could be used
to reference the filed value, the addition of the occurrence number (.1.) invalidates
that Javascript. For example:
UV7.2.04 - parent.basefrm.document.forms[0].elements["FIELD_NAME.ENTITY.MODEL"].value="FIELD_VALUE"
Needed to be modified to work in
UV7.2.05 - parent.basefrm.document.forms[0].elements["FIELD_NAME.ENTITY.MODEL.1."].value="FIELD_VALUE"
Occurrence handling in Uniface V7.2.05
A UNIFACE Web form is a stateless form that is only active for the duration
of a user request. When an HTML form is created, UNIFACE handles occurrences
by adding additional information about each occurrence. The beginning of each
occurrence is marked with information about the database state of that occurrence.
Two hidden fields are added to each occurrence in the HTML source just before
the first field. The names of these fields start with a hash character (#).
The value of the first field is the partially encoded primary key, and the second
field is the CRC checksum.
If the occurrence was already stored in the database, the invisible field added
just before the first entity field starting with a hash character (#) contains
the value of the partially encoded primary key of this occurrence. This is done
so that UNIFACE can restore the database context in the next request. For example:
Field name handling in Uniface V7.2.05
and implications with using javascript
HTML 4.0 does not make provision for occurrences. UNIFACE handles this by including
an occurrence index number in the field name generated for each field. Each
field name is the full description of FIELD.ENTITY.MODEL with the addition of
an occurrence number (.1.). All fields of the same occurrence have the same
index number
Nested entity field names are identified with and additional inner level occurrence
number. For example:
<INPUT TYPE="HIDDEN" NAME="%.OUTER_ENTITY.MODEL.1." VALUE="">
<INPUT TYPE="HIDDEN" NAME="%.INNER_ENTITY.MODEL.1-1." VALUE="">
<INPUT TYPE="HIDDEN" NAME="%.INNER_INNER_ENTITY.MODEL.1-1-1." VALUE="">
<INPUT TYPE="HIDDEN" NAME="%.INNER_ENTITY.MODEL.1-2." VALUE="">
Uniface Library Documentation Summary
on Working with HTML and Javascript
Uniface Library:
How to -> Construct components
-> Working with HTML skeletons
-> Working with JavaScript
To address another field belonging to the same occurrence as the currently active
field, do the following (an occurrence level event is required in order to utilize
this method to address fields in the same occurrence in a Web page with JavaScript):
Recommendations
We have noticed some unpredictable behavior (such
as indexes that are .1 instead of the expected .1.). We are currently still
in the process of establishing a more formal way for dealing with occurrence
handling.
For now, when the needed functionality can
be triggered by an occurrence level event, use the example documented
in the Uniface library and described above by indirectly referencing the
javascript name.
If the field name is unique to the HTML source (single occurrence entity
field - "FIELD_NAME.ENTITY.MODEL"), you can loop through the object names
searching for a specified name in the page using the javascript find method.
This will only work if there is one occurrence of that field.
Otherwise, the field names will have to be hardcoded for the time being.