Dynamic forms in the regular module

Prev Next

Given:

  • A module that keeps the job items

  • Each item represents a job of certain type: Print, TV, Web etc.

  • Fields present in the item:

Field Name

Field Content

Field Type

Values

Note

Job Name

Text

Text

 

Base field

Job Type

Text

Selectbox

  • Print

  • TV

  • Web

Base field

Paper size

Text

Text

 

Related to job type “Print”

Artwork

Text

Text

 

Related to job type “Print”

TV channel

Text

Selectbox

  • MTV

  • National

Related to job type “TV”

Broadcast

Date

Date-Time

 

Related to job type “TV”

Needed:

  • When creating a new job or editing existing one, user should see only the fields, that are relevant to the chosen job type.

    image_4.png

Configuration steps:

  1. Create field templates and configure the field visibility for them:
    ! Note that Base Template configuration is not needed for v.15+. Base fields are configured in item view configuration.
    Module > Field Templates
    image1.pngModule > Field Usage > Templates
    image2.png

  2. (!For versions before v.15! )Assign Base template in Module > Settings > Field Template for Add/Edit Item.

    image6.png

  3. Assign Print template and TV template to corresponding options in Module > Field definition > Job Type. Leave the option “Web” without any template assigned.

    image3.png

  4. For v.15+: Fields that are configured to be shown by dynamic forms should not be present in item view configuration. 

  5. Go to module search result and try to create a new item. 

    As a result you will see that initially only 2 base fields are shown in Add Item window: Job Name and Job Type. Selecting a value in Job Type selectbox (e.g. Print), will additionally show the fields Paper size and Artwork related to print job type. If you change the job type to TV, fields related to print will be hidden and TV channel and Broadcast shown instead. Selecting job type Web will not show any additional fields just hide not relevant, since this option has no specific template assigned and inherit the Base template.

    image5.png