Interface IXItemFieldNameConventions
-
- All Known Implementing Classes:
DefaultXItemFieldNameConventions
,EBuiltinFieldNameConventions
public interface IXItemFieldNameConventions
Describes the naming conventions for the form fields used by this type of form item. The default assumption is that in the rendered form, only a single form field (such as<input>
) exists, with the name as configured in the form designer. The default implementation returnsDefaultXItemFieldNameConventions
, which is suitable for such form items.Some form items may have more complex naming conventions. For example, an upload form item could have a secondary input field for storing the UUID of the upload; and the name of that derived input field could e.g. be the configured name (e.g.
upl1
) plus some suffix (e.g.upl1.uuid
). Other form could have more derived field names with various data, as is the case for e.g. the builtin appointment picker form item with various related field names suchapp1_date
,app1_time
,app1_date_time
, orapp1.typeuuid
etc.Implementations of this interface contain the field name conventions for such items, so that these conventions can be respected and enforced by formcycle. formcycle must be aware of the naming conventions for various reason, e.g. in order to be able to reject submitted request values when the request value belongs to a form item that is unavailable
in a certain state
orfor certain user groups
.- Since:
- 8.1.0
- Author:
- XIMA MEDIA GmbH
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Set<String>
findRelatedBaseNames(String baseName)
Given the base name of a form item, returns the set of additional related names that might be submitted.String
resolveRelatedBaseName(String relatedBaseName)
Given the base name of a request value, finds the base name of the form item that produced this request value.
-
-
-
Method Detail
-
findRelatedBaseNames
Set<String> findRelatedBaseNames(String baseName)
Given the base name of a form item, returns the set of additional related names that might be submitted.For example, when the form contains an autocomplete element with the name
sel1
, the form submission might include a value for the related namesel1_autocomplete
in addition to the value for the namesel1
. This method should then return a set with the one valuesel1_autocomplete
when called with the base namesel1
.This is the inverse operation of
resolveRelatedBaseName
. If this method is given a stringX
and returns a set of stringsY
, thenresolveRelatedBaseName
must returnX
if given any of the stringsY
.This method is never given a derived name for repeated form fields. Repeated form fields use the convention
tf1_dyn_fs1_0
(item base name tf1, container base name fs1, repetition ID 0).- Parameters:
baseName
- The base name of an item.- Returns:
- A set of related base names.
null
or the empty set when there are no related base name.
-
resolveRelatedBaseName
String resolveRelatedBaseName(String relatedBaseName)
Given the base name of a request value, finds the base name of the form item that produced this request value.For example, when the form contains an autocomplete element with the name
sel1
, the form submission might include a value for the related namesel1_autocomplete
in addition to the value for the namesel1
. This method should then returnsel1
when given the namesel1_autocomplete
.This method is never given a derived name for repeated form fields. Repeated form fields use the convention
tf1_dyn_fs1_0
(item base name tf1, container base name fs1, repetition ID 0).This is the inverse operation of
findRelatedBaseNames
. IffindRelatedBaseNames
is given a stringX
and returns a set of stringsY
, then this method must return. X
if given any of the stringsY
.- Parameters:
relatedBaseName
- A related base name to resolve.- Returns:
- The resolved base name.
null
, the empty string, or the argument itself when the name is unknown to this conventions instance.
-
-