Module:Validation/doc

This module is primarily intended for validating fields of infoboxes, although it is also usable for automatically performing other tasks based on fields in infoboxes.

Currently, it contains a single function, validateFields, which will insert text where invoked based on checks performed on single fields. This is most obviously useful for automatically adding categories based on infobox fields, but this isn't the only type of text that can be inserted. As of right now, only a single field can be checked in a single way to determine whether to insert a particular piece of text. If more complex functionality is required in the future, it will be implemented on an as-needed basis.

There are currently four types of checks that can be performed: present, absent, equals, and contains. As many of these checks as desired can be performed with a single invoke, simply by appending each one after the previous one. A single check has either three or four arguments. The first is the type of check (present, absent, equals, or contains). The second is the name of the field. The last is the text to insert if the check evaluates to true. If the check is either equals or contains, a fourth argument immediately after the name of the field is required, which contains what you want to check the field either equals or contains.

Usage
Presence of field:

Absence of field:

Field equals value:

Field contains value:

Multiple checks:

Example usage
Let's say we have an infobox where we have a deprecated field, required field  , and field. We want to add pages with the deprecated field and pages missing the required field to the relevant categories, and we want to add all instances of a particular birthday (September 13) to another category. We can take care of all of these at once with a single invoke in the infobox template after the  tag: