Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
( isWizard & ( hasSpellSlots | hasWand))

Question

Is there a nice way that for any thing that can take an inline expression, it could also take a "link" to an external javascript function, or to a java class?

Features

Dynamically Enabled

...

Code Block
fields:
	isBarbarian:
		fieldType: checkbox
		type: Boolean
	isElf
		fieldType: checkbox
		type: Boolean
    barbarianElfHatType:
		fieldType: text
		enabled: ( isBarbarian & isElf )
        description: What type of hat is your elven barbarian wearing?

Dynamically

...

Visible

A field is only present visible on a form, that is - visible and also being stored to the persistance layer - if the  "presentvisible" expression evaluates to true.

Could also be called "present" instead of "visible".

Code Block
fields:
	barbarianElfHatType:
		fieldType: text
		presentvisible: ( isBarbarian & isElf )

...

Code Block
fields:
	clericSpells:
		fieldType: text
		validators:
            onlyClericOrWizard:
              class: info....ExpressionValidator
              expression: (!(clericSpells!="" & wizardSpells!=""))
			  errorMessage: Only Cleric OR Wizard spells allowed, not both.


Dynamic Label

...

& Dynamic Button Labels

TODO.

Use expression, Javascript or Java, to determine which hardcoded string is displayed, or which i18n key is retrieved.

For example this can be used with a Static field, to provide a label that reacts to things selected in other controls.

"This combination of herbs soothes your mind and promotes concentration"TO DO.

Dynamic Options

Populate the options of a selectbox, set of radiobuttons, or twincolumn select, based on the value of other fields.

We provide some out-of-the-box modes where no custom coding is required, but also make it easier for developers to fulfil this use case with a minimum of coding for more custom use cases.


dynamicSelect Field and optionModel Class

Developer provides a Java class or a JS class Javascript function which takes the values of the fields specifed in "optionModelArguments" as arguments, and returns an array of label & value pairs to populate the options field with.

Options list is empty until the "optionModelArguments" fields have values.

Code Block
fields:
	heroType:
		fieldType: select
		options:
			- wizard
			- cleric
			- fighter
			- thief
	level:
		fieldType: select
		options:
			- 1
			- 2
			- 3
			- 4

    spells:
		fieldType: dynamicOptionsdynamicSelect
		optionModelArguments
			- heroType
			- level
		optionModel: org.dandelion......AvailableSpells
        description: Choose from your available spells, after choosing your heroType and level.

Another example:

Code Block
fields:
	country:
		fieldType: select
		path: /
		repository: countries

    state:
		fieldType: dynamicSelect
		optionModelArguments
			- country
		optionModel: org.dandelion......StatesPerCountry

    postalCode:
		fieldType: dynamicSelect
		optionModelArguments
			- state
		optionModel: org.dandelion......PostalCodesPerState

Node Chooser

Out-of-the-box field fields based on a heirarchy of nodes. (Not necessarily Possibly JCR bound.)

introduce two new dynamic field types:

dynamicLinkdynamicNodeLink:

A link field which gets its workspace from another field.dynamicNodeOptions

dynamicNodeSelect:

A selectbox which gets its options based on a parentNode from another field.

By default it only returns the immediate children.


Code Block
fields:
	myWorkspace:
		fieldType: workspace

	myParentNode:
		fieldType: dynamicLinkdynamicNodeLink
		workspace: myWorkspace
		nodeTypes:
			- mgnl:folder

    assets:
		fieldType: dynamicNodeOptionsdynamicNodeSelect
		parentNode: myParentNode
        includeAllDecendants: true
		nodeTypes:
			- mgnl:asset


Note: Can we make this ContentType-centric instead of JCR-centric so that it is usable OOTB on external content sources?




Notes

Take a look at linked tickets on: 

Jira
serverMagnolia - Issue tracker
serverId500b06a6-e204-3125-b989-2d75b973d05f
keyMGNLUI-2542

...