Versions Compared

Key

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

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.

Code Block
( isWizard & ( hasSpellSlots | hasWand))

Features

Dynamically Enabled

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

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

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.

Code Block
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.

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


Dynamic Options




Notes

Take a look at linked tickets on: 

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

...