Form Logic

Component ID

1963020

Component name

Form Logic

Component type

module

Maintenance status

Development status

Component security advisory coverage

not-covered

Component created

Component changed

Component body

This module provides options for conditionally adding validation rules to to node add/edit forms and conditionally adding other modifications to the form, e.g. hiding fields. Options are added through configuration, so no custom code is required. This allows the 'end configurer' to set up validation and other form customisation, globally or on a per role basis. The 'end configurer' can do this without writing any code.

  • Add validation rules to forms using UI. No code required.
  • Conditionally add validation rules:
    • apply a validation rule if the user has (or does not have) a specified role
    • apply a validation rule if another field is set to a particular value, e.g. if the 'Special offer' field is set to 'Bargain' require that the price field has a maximum value of 9.99.
  • Hide fields on form using UI.
  • Conditionally hide fields on forms based on user's role
  • Show additional guidance to forms based on the user's role
  • limit taxonomy term choices, i.e. exclude certain taxonomy terms for users with a given role (or for all user of that form)
  • (for future: lock fields, i.e. prevent editing)

Form Logic is configured by content type rather than by field. (For future: taxonomy and comment fields too.) The same field can be validated / hidden (for future: locked and limited) in different ways in different context (and in different ways for different roles.)

Current status

This module is currently working towards 'Proof of concept / basic version' milestone. Don't expect everything to work or anything to work with complete reliability. Don't even think about using on a production site.

Road map

  • Proof of concept / basic version
    • Get up and running with single condition + single behaviour / validation per field (Done)
    • Add decent initial range of conditions, behaviours and validations (a range, albeit not yet a decent range)
  • More useful version
    • Multiple conditions + multiple behaviour / validation per field (done)
    • Mechanism to re-use / re-cycle settings, e.g. if settings have been applied to field in context A, allow user to clone settings for context B
  • Yet more useful version
    • Think about export / features support etc. for moving configuration from site to site
    • Integrate with Rules
    • Hooks etc.

Related modules

Field Validation - allows 'end configurer' to add validation to fields (and do on a per bundle / content-type basis). UI is field-centric rather than bundle / content-type centric. I'd argue the UI is more complex and less 'end configurer' friendly. (Unless I've missed this), it does not provide conditional validation, e.g. different validation rules for different user roles. Well maintained module.

Node Form Mutator - may overlap with Form Logic

Conditional Fields - definitely some overlap with Form Logic. Does not support validation. Does not yet have a recommended release for D7.

Field Conditional State - some overlap with Form Logic. Does not support validation.