Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
HTML Wrap
clearboth
alignright
classmenu

Related topics:

This page describes two ways in which you may define the type of a field in a form.

Table of Contents

When creating a dialog, you usually want it to contain fields that build its core functionality for user tasks such entering a text into a field and sending it to the server upon hitting the SUBMIT button. Any field like that must be defined in a dialog definition through a field definition which must contain – at minimum – a property telling Magnolia what type of field it should render in the dialog.

Using the class property

Until the release of Magnolia 5.7, the only way to specify the type of a field was to state its fully qualified class name. For example, to create a simple text field named title in a dialog's tab called tabText you had to include the following code in the configuration of the dialog:

Code Block
languageyaml
form:
  tabs:
    - name: tabText
      fields:
        - name: title
          class: info.magnolia.ui.form.field.definition.TextFieldDefinition

Using the fieldType property and with short field names

For legibility, ease of development, and to make field names easier to remember, Magnolia 5.7 changed this in two ways:

  • You no longer need to specify the field type using the fully qualified class name. You need to set just the field name proper via the fieldType property.
  • In selected modules (see the Short field names list below on this page), the field name does not even require the -Field or -FieldDefiniton suffix. 

For the example with the text field this means that the configuration can look like as this:

Code Block
languageyaml
form:
  tabs:
    - name: tabText
      fields:
        - name: title
          fieldType: text


TODO

Short field names

Include Page
_field names shortening
_field names shortening