You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 7 Next »

Concept

Introduce the ability to supply logical expressions which can use the values of other fields in order to determine the state on a field.

Expressions might be javascript, or some other expression language.

Maybe expressions are indicated by parenthesis.

( isWizard & ( hasSpellSlots | hasWand))

Features

Dynamically Enabled

The enabled property can take a logical expression as well as a simple boolean value.

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 Present

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

fields:
	barbarianElfHatType:
		fieldType: text
		present: ( isBarbarian & isElf )

Dynamically Validated

Expand the regexp validator to be able to operate not just on the current field, but to include values from other fields.

Introduce a new "expression" validator which can take a logical expression, and which can include values from other fields.

By placing at the field level, devs would have control of where validation messages and hilights appear.

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


Dynamic Label

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.


optionModel Class

Developer provides a Java class or a JS class 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.

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

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


Node Chooser

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

introduce two new dynamic field types:

dynamicLink: A link field which gets its workspace from another field.

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

fields:
	myWorkspace:
		fieldType: workspace

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

    assets:
		fieldType: dynamicNodeOptions
		parentNode: myParentNode
        includeAllDecendants: true




Notes

Take a look at linked tickets on:  MGNLUI-2542 - Getting issue details... STATUS


It would be useful to have a Super-link field where I have a first select box to choose a workspace "tours, pages, contacts", and then a link field below it that lets me choose an item from that workspace.


From:  Dynamic forms and cross-field validation

  • populating select options based on the value of another field
  • validating a field depending on the value of another field (including within a composite field itself)
  • enabling/disabling fields conditionally
  • updating form buttons (enabling/disabling/relabeling)


Filtered Multi Select Choose Dialog


It would be good to ask a support representative:

Maybe Rich or Mercedes.



  • No labels