Skip to main content

Conditionals schema examples

These schema examples demonstrate the use of conditionals.

Conditionals: example one
Link copied!

This example demonstrates the use of conditionals to:

  • Set the validation of the addressCode property based on the value selected for the value property.

  • Determine whether the date property is shown or hidden based on the value of the hasDate property.

Interactive

This example is best viewed on a desktop browser where the schema editor is fully interactive.

    Conditionals: example two
    Link copied!

    This example shows the use of multiple conditional fields.

    • condition1 will hide the altText property until an image has been added.
    • condition2 enables the author name field if a publication date is chosen. It sets the authorName to be readOnly if date is null.
    • condition3 uses the value of the switch boolean property to show additional properties for an image or video.
    • condition4 will add additional fields for custom width and height if the value of the dropList property indicates that a custom aspect ratio is selected.
    • condition5 adds additional fields for width, height and margin if any text is entered in the libraryIcon text field.
    Interactive

    This example is best viewed on a desktop browser where the schema editor is fully interactive.

      Validation keywords